Ejemplo n.º 1
0
import websocket
import json
from ta.momentum import rsi
import numpy
from binance.enums import *
from binance.client import Client
import config
from pprint import pprint

# define the client
client = Client(config.api_key, config.api_secret)


info = (client.get_account_snapshot(type='SPOT')

pprint(info)
def get_future_trade(symbol, order_id, qty):
    trade = None

    while not trade or sum([int(t['qty']) for t in trade]) < qty:
        # binance_trades = binance_client.get_my_trades(symbol=symbol, fromId=from_id)
        binance_trades = binance_client.futures_coin_account_trades(symbol=symbol)

        trades = [trade for trade in binance_trades if trade['orderId'] == int(order_id)]

        trade = trades if len(trades) else None

    return trade

if __name__ == '__main__':
    from datetime import datetime

    binance_client = Client(api_key, api_secret, testnet=True)

    start = datetime.utcnow()

    # print(binance_client.get_order_book(symbol="DOTUSDT", limit=5))

    # [print(book) for book in binance_client.get_orderbook_tickers()]


    print(binance_client.get_account_snapshot(type='SPOT'))

    print(datetime.utcnow() - start)