Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from decimal import *
- def f(a, b):
- from binance.client import Client
- #import decimal
- getcontext().prec = 8
- liczbaA = Decimal(0.8)
- liczbaB = Decimal(0.999)
- bottomLimitMnoznik = Decimal(0.95)
- client = Client(a, b)
- amount = Decimal(input("Ilosc: "))
- str = input("Coin: ")
- str = str + "BTC"
- order={'executedQty': '0.1','price': '0.1'}
- info = client.get_symbol_info(str)
- liczbaC = Decimal(info['filters'][1]['stepSize'])
- old = Decimal(client.get_orderbook_ticker(symbol=str)['askPrice'])
- amount = amount / old
- amount = amount - amount % liczbaC
- test = True
- last = "sell"
- while test:
- #new = 0
- #for i in range(1, 4):
- # new += Decimal(client.get_symbol_ticker(symbol=str)['price'])
- #new = new / 3
- new = Decimal(client.get_symbol_ticker(symbol=str)['price'])
- print(new/old)
- print(new / old < liczbaB)
- print(last == "buy")
- if new / old > 1 / liczbaB and last == "sell":
- order2 = client.order_market_buy(
- symbol=str,
- quantity=amount)
- print("Buy:")
- print(order2)
- amount = order2['executedQty']
- last = "buy"
- #new = 0
- #for i in range(1, 4):
- # new += Decimal(client.get_symbol_ticker(symbol=str)['price'])
- #new = new / 3
- old = new
- if new / old < liczbaB and last == "buy":
- order2 = client.order_market_sell(
- symbol=str,
- quantity=amount)
- print("Sell")
- print(order2)
- amount = order2['executedQty']
- last = "sell"
- old = new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement