question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

javascript works for FTX us, but not python

See original GitHub issue
  • OS: Microsoft Windows 10
  • Programming Language version: Python3.8.1, Javascript
  • CCXT version: 1.55

Hi, I’ve been trying to get the python version of the ftx api working with the following code.

import ccxt
exchange = ccxt.ftx({
    'apiKey': '',
    'secret': '',
    'hostname': 'ftx.us',
    'name': 'FTXUS',
})

print(exchange.fetch_balance())

And am receiving the following error:

AuthenticationError: ftx {"success":false,"error":"Not logged in"}

If, however, I download ccxt with npm and run the following javascript code, using the same key and secret as in the code above, the command to fetch account balances, it goes through fine.

"use strict";

const ccxt = require ('C:/Users/guysh/node_modules/ccxt/ccxt.js')
;(async function main () {

    const exchange = new ccxt.ftx ({
        'apiKey': '',
        'secret': '',
        'hostname': 'ftx.us',
        'enableRateLimit': true,
    })

    await exchange.loadMarkets ()

    const ninetyDays = 90 * 24 * 60 * 60 * 1000;
    let startTime = exchange.parse8601 ('2018-01-01T00:00:00')
    const now = exchange.milliseconds ()
    const currencyCode = undefined // any currency

    const balances = await exchange.fetchBalance()
    console.log(JSON.stringify(balances, null, 4));

I’ve compared the signatures being created for a given timestamp between the two scripts as well, and they are identical. As a result, I’m really not sure why the js code goes through fine, and the python code returns an authentication error. Any insight would be greatly appreciated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gshippeecommented, Sep 6, 2021

Hi Kroitor, just resolved the issue. Somehow my clock wasn’t syncing correctly for python, so the timestamp was getting messed up. Thank you for your time and for helping me remove the other variables that could have potentially been an issue here from the list.

1reaction
gshippeecommented, Sep 6, 2021

Ok, I will try to do the same with a linux system and let you know the results on my side. Thank you for your support in helping debug this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FTX API - A Complete Guide - AlgoTrading101 Blog
FTX API is a method that allows us to automatically trade cryptocurrencies ... As of 2021, FTX does not onboard or provide services...
Read more >
How to Use FTX REST API in Python - Finxter
What is FTX? FTX is an exchange where users can trade various digital assets, such as cryptocurrencies, tokenised stocks and derivatives.
Read more >
FTX REST API: A Complete Python Tutorial (2022)
Learn how to use the FTX REST API in Python to trade cryptocurrencies and develop crypto applications in this comprehensive guide.
Read more >
ftx · GitHub Topics
A lightweight trading bot for automated algorithmic trading on Binance Futures, FTX and BitMEX written in python. python bot crypto trading websocket trading- ......
Read more >
SEC Charges Samuel Bankman-Fried with Defrauding ...
(FTX), the crypto trading platform of which he was the CEO and co-founder. Investigations as to other securities law violations and into other ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found