⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
home
/
erol
/
View File Name :
limital.py
import decimal import math import time from binance.client import Client from binance.um_futures import UMFutures import pymysql from requests.exceptions import ConnectTimeout from binance.exceptions import BinanceAPIException from datetime import datetime, timedelta import subprocess import argparse parser = argparse.ArgumentParser() parser.add_argument("-symbol", help="Sembol Giriniz", required=True) parser.add_argument("-yon", help="yon Giriniz", required=True) args = parser.parse_args() symbol = args.symbol yon = args.yon def ceretae_um_futures_client(ayar): return UMFutures(ayar["binanceapikey"], ayar["binancesecretkey"],base_url="https://testnet.binancefuture.com") try: baglanti = pymysql.connect( host='127.0.0.1', db='newcoin', user='root', password='Ua04420076*', port=3306, charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor ) with baglanti.cursor() as islem: try: islem.execute("select * from settings where id=1") ayar=islem.fetchone() baglanti.commit() um_futures_client = ceretae_um_futures_client(ayar) limit_bitirildi = False acikemirler = um_futures_client.get_orders(symbol=symbol) long_orders = list(filter(lambda order: order["positionSide"] == "LONG" and order['symbol']==symbol, acikemirler)) short_orders = list(filter(lambda order: order["positionSide"] == "SHORT" and order['symbol']==symbol, acikemirler)) sayi=len(long_orders) if yon=='LONG' else len(short_orders) while not limit_bitirildi: if sayi==8: limit_bitirildi = True break sayi += 1 islem.execute("select * from symbols where symbol=%s",symbol) data=islem.fetchone() baglanti.commit() if data['longsay']=="0" and yon=="LONG": islem.execute("update symbols longsay=1 where symbol=%s",symbol) baglanti.commit() if data['shortsay']=="0" and yon=="SHORT": islem.execute("update symbols shortsay=1 where symbol=%s",symbol) baglanti.commit() islem.execute("select * from symbols where symbol=%s",symbol) data=islem.fetchone() baglanti.commit() kacinci=float(data['longsay']) if yon=="LONG" else float(data['shortsay']) price=float(data['L_entryPrice']) if yon=="LONG" else float(data['S_entryPrice']) aralik=float(data['aralikyuzde'])*kacinci kaldirac =float(data['leverage']) quantity = "{:.{}f}".format(math.ceil((float(data['aralikmargin']) * kaldirac) / price), data['qp']) stop_loss_price = (price * (1+(aralik/kaldirac/100))) if yon=="LONG" else (price * (1-(aralik/kaldirac/100))) hedefprice ="{:0.0{}f}".format(stop_loss_price, data['pp']) open_long = um_futures_client.new_order( symbol=symbol, side=Client.SIDE_BUY if yon=="LONG" else Client.SIDE_SELL, positionSide="LONG" if yon=="LONG" else "SHORT", quantity=quantity, timeInForce = Client.TIME_IN_FORCE_GTC, type=Client.FUTURE_ORDER_TYPE_STOP, price = hedefprice, stopPrice = hedefprice ) if open_long: kacinci += 1 if yon=="LONG": islem.execute("update symbols set longsay=%s where symbol=%s",((kacinci),symbol)) baglanti.commit() elif yon=="SHORT": islem.execute("update symbols set shortsay=%s where symbol=%s",((kacinci),symbol)) baglanti.commit() except Exception as e: print(f"Bilinmeyen bir hata oluştu: {e}") um_futures_client = ceretae_um_futures_client(ayar) except KeyboardInterrupt: print("Ctrl+C'ye basıldı, program kapatılmayacak.") while True: pass finally: if 'baglanti' in locals(): baglanti.close()