def get_kline(request): # instrument_id = request.data.get('instrument_id') instrument_id = request.GET.get('instrument_id') start = request.GET.get('start') end = request.GET.get('end') granularity = request.GET.get('granularity') spotAPI = spot.SpotAPI(api_key, secret_key, passphrase, False) result = spotAPI.get_kline(instrument_id, granularity) return HttpResponse(json.dumps(result), content_type="application/json")
def get_account_info(request): account_type = request.GET.get('account_type') if account_type == '1': spotAPI = spot.SpotAPI(api_key, secret_key, passphrase, False) # 币币账户信息 (20次/2s) result = spotAPI.get_account_info() elif account_type == '3': futureAPI = future.FutureAPI(api_key, secret_key, passphrase, False) result = futureAPI.get_accounts() elif account_type == '6': accountAPI = account.AccountAPI(api_key, secret_key, passphrase, False) result = accountAPI.get_wallet() elif account_type == '8': accountAPI = account.AccountAPI(api_key, secret_key, passphrase, False) result = accountAPI.get_wallet() elif account_type == '9': swapAPI = swap.SwapAPI(api_key, secret_key, passphrase, False) result = swapAPI.get_accounts() elif account_type == '16': swapAPI = swap.SwapAPI(api_key, secret_key, passphrase, False) result = swapAPI.get_accounts() else: request = ({}) return HttpResponse(json.dumps(result), content_type="application/json")
def get_specific_ticker(request): # instrument_id = request.data.get('instrument_id') instrument_id = request.GET.get('instrument_id') spotAPI = spot.SpotAPI(api_key, secret_key, passphrase, False) result = spotAPI.get_specific_ticker(instrument_id) return HttpResponse(json.dumps(result), content_type="application/json")
def get_all_ticker(request): spotAPI = spot.SpotAPI(api_key, secret_key, passphrase, False) result = spotAPI.get_ticker() return HttpResponse(json.dumps(result), content_type="application/json")
def get_depth(request): instrument_id = request.GET.get('instrument_id') size = request.GET.get('size') spotAPI = spot.SpotAPI(api_key, secret_key, passphrase, False) result = spotAPI.get_depth(instrument_id, size) return HttpResponse(json.dumps(result), content_type="application/json")