import kuna.kuna as kuna import trading_bot.kuna_api_access.kuna_local_config as kuna_config kuna_api = kuna.KunaAPI(access_key=kuna_config.KUNA_API_PUBLIC_KEY, secret_key=kuna_config.KUNA_SECRET_KEY) pairs = kuna.VALID_MARKET_DATA_PAIRS market_data = kuna_api.get_recent_market_data('btcuah') print(market_data['ticker'])
def __init__(self, \ publicKey, \ privateKey): self.__apiObject = kuna.KunaAPI(publicKey, privateKey)
)) / 100 buy_volume = config['buy_volume'] sell_volume = config['sell_volume'] json.dump(config, open(r'build\config.json', 'w'), indent=2) break except ValueError: print('ОШИБКА Введенные данные должны быть числами') except Exception: print('ОШИБКА Произошла неизвестная ошибка') input('Завершение работы >>>...') raise SystemExit MARKET_1 = 'usdtuah' MARKET_2 = 'tusduah' graph_kuna = kuna.KunaAPI(access_key=config['keys']['access_key'], secret_key=config['keys']['secret_key']) PRIVAT_CURRENCY_RATE_REQUEST = 'https://api.privatbank.ua/p24api/pubinfo?exchange&json&coursid=11' MINFIN_CURRENCY_RATE_REQUEST = 'http://api.minfin.com.ua/summary/0e5bb35206edff8a21758a054172ca3dc08c1d4c/' def put_buy_order(market, volume, buy_rate, target_order=None): users_active_orders = graph_kuna.get_orders(market) all_active_buy_orders: list = requests.request( 'GET', 'https://kuna.io/api/v2/depth', params={ 'market': f'{market}' }).json()['bids'] all_active_buy_orders.sort(key=lambda order1: -float(order1[0])) market_buy_rate = round(float(all_active_buy_orders[0][0]), 2) buy_config = json.load(open(r'build\config.json', 'r')) for active_buy_order in all_active_buy_orders[1:]: