Giter Site home page Giter Site logo

Comments (7)

kroitor avatar kroitor commented on May 8, 2024 1

Ok, I fixed it, finally. Now it replies with "Insufficient funds" as it should.
Code for testing:

# Python
import ccxt
gdax = ccxt.gdax ({ 
	'apiKey': '92560ffae9b8a01d012726c698bcb2f1', # standard
	'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', 
	'password': '6kszf4aci8r', # GDAX requires a password!
})
gdax.urls['api'] = 'https://api-public.sandbox.gdax.com'
gdax.load_products ()
gdax.create_limit_buy_order ('BTC/USD', 1, 2000)

The problem was that their sandbox does not accept client_oid field. Removed it. Should work now. Thanks again!

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

Thanks for a detailed report! Can you please paste the following short test in python console and report on what you get:

# Python
import ccxt
gdax = ccxt.gdax ({ 
	'apiKey': '92560ffae9b8a01d012726c698bcb2f1', # standard
	'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', 
	'password': '6kszf4aci8r', # GDAX requires a password!
})
gdax.urls['api'] = 'https://api-public.sandbox.gdax.com'
gdax.fetch_balance ()

Note, that GDAX requires the password for authentication. Read the API Keys Setup section in the Manual for more details.
Waiting for your reply.

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

Fixing this...

from ccxt.

marinsokol5 avatar marinsokol5 commented on May 8, 2024

I have tried your code and the methods still don't work unofrtunately.
My code is similar I have also been testing it on sandbox with a password.

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

It seems like I fixed it, and the order signatures are now generated correctly, but their sandbox matching engine responds with 'offline' message. Should work normally though when it's back online or on production.

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

Here is how I test:

mbp:ccxt igorkroitor$ python
Python 2.7.13 (default, Jun  5 2017, 10:04:07) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ccxt
>>> gdax = ccxt.gdax ({ 
...     'apiKey': '92560ffae9b8a01d012726c698bcb2f1', # standard
...     'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', 
...     'password': '6kszf4aci8r', # GDAX requires a password!
... })
>>> gdax.urls['api'] = 'https://api-public.sandbox.gdax.com'
>>> gdax.create_limit_buy_order ('BTC/USD', 1, 2000)
('gdax', 'POST', 'https://api-public.sandbox.gdax.com/orders', 400, 'Bad Request', 'Market Not Available')
('gdax', 'POST', 'https://api-public.sandbox.gdax.com/orders', 400, 'Bad Request', '{"message":"Matching engine offline"}')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ccxt/__init__.py", line 504, in create_limit_buy_order
    return self.create_order (product, 'limit', 'buy', amount, price, params)
  File "ccxt/__init__.py", line 6422, in create_order
    return self.privatePostOrders (self.extend (order, params))
  File "ccxt/__init__.py", line 6448, in request
    return self.fetch (url, method, headers, body)
  File "ccxt/__init__.py", line 238, in fetch
    raise MarketNotAvailaibleError (self.id + ' ' + error)
ccxt.MarketNotAvailaibleError: gdax Market Not Available

mbp:ccxt igorkroitor$ python3
Python 3.6.1 (default, Jul 10 2017, 04:32:51) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ccxt
gdax = ccxt.gdax ({ 
	'apiKey': '92560ffae9b8a01d012726c698bcb2f1', # standard
	'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', 
	'password': '6kszf4aci8r', # GDAX requires a password!
})
gdax.urls['api'] = 'https://api-public.sandbox.gdax.com'
gdax.create_limit_buy_order ('BTC/USD', 1, 2000)
>>> gdax = ccxt.gdax ({ 
...     'apiKey': '92560ffae9b8a01d012726c698bcb2f1', # standard
...     'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', 
...     'password': '6kszf4aci8r', # GDAX requires a password!
... })
>>> gdax.urls['api'] = 'https://api-public.sandbox.gdax.com'
>>> gdax.create_limit_buy_order ('BTC/USD', 1, 2000)
gdax POST https://api-public.sandbox.gdax.com/orders 400 Bad Request b'{"message":"Matching engine offline"}'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/igorkroitor/ccxt/ccxt/__init__.py", line 504, in create_limit_buy_order
    return self.create_order (product, 'limit', 'buy', amount, price, params)
  File "/Users/igorkroitor/ccxt/ccxt/__init__.py", line 6422, in create_order
    return self.privatePostOrders (self.extend (order, params))
  File "/Users/igorkroitor/ccxt/ccxt/__init__.py", line 6448, in request
    return self.fetch (url, method, headers, body)
  File "/Users/igorkroitor/ccxt/ccxt/__init__.py", line 207, in fetch
    response = opener.open (request, timeout = int (self.timeout / 1000))
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

So now it's the problem with their sandbox matching engine. Will wait for it back online and test later again.

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

So now it says "Insufficient funds" as it should... Will add an exception for this case, though.

mbp:ccxt igorkroitor$ python3
Python 3.6.1 (default, Jul 10 2017, 04:32:51) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ccxt
>>> gdax = ccxt.gdax ({ 
...     'apiKey': '92560ffae9b8a01d012726c698bcb2f1', # standard
...     'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', 
...     'password': '6kszf4aci8r', # GDAX requires a password!
... })
>>> gdax.urls['api'] = 'https://api-public.sandbox.gdax.com'
>>> gdax.load_products ()
{'BTC/USD': {'id': 'BTC-USD', 'symbol': 'BTC/USD', 'base': 'BTC', 'quote': 'USD', 'info': {'id': 'BTC-USD', 'base_currency': 'BTC', 'quote_currency': 'USD', 'base_min_size': '0.01', 'base_max_size': '10000', 'quote_increment': '0.01', 'display_name': 'BTC/USD'}}, 'BTC/GBP': {'id': 'BTC-GBP', 'symbol': 'BTC/GBP', 'base': 'BTC', 'quote': 'GBP', 'info': {'id': 'BTC-GBP', 'base_currency': 'BTC', 'quote_currency': 'GBP', 'base_min_size': '0.01', 'base_max_size': '10000', 'quote_increment': '0.01', 'display_name': 'BTC/GBP'}}, 'BTC/EUR': {'id': 'BTC-EUR', 'symbol': 'BTC/EUR', 'base': 'BTC', 'quote': 'EUR', 'info': {'id': 'BTC-EUR', 'base_currency': 'BTC', 'quote_currency': 'EUR', 'base_min_size': '0.01', 'base_max_size': '10000', 'quote_increment': '0.01', 'display_name': 'BTC/EUR'}}, 'ETH/BTC': {'id': 'ETH-BTC', 'symbol': 'ETH/BTC', 'base': 'ETH', 'quote': 'BTC', 'info': {'id': 'ETH-BTC', 'base_currency': 'ETH', 'quote_currency': 'BTC', 'base_min_size': '0.01', 'base_max_size': '1000000', 'quote_increment': '0.00001', 'display_name': 'ETH/BTC'}}, 'ETH/USD': {'id': 'ETH-USD', 'symbol': 'ETH/USD', 'base': 'ETH', 'quote': 'USD', 'info': {'id': 'ETH-USD', 'base_currency': 'ETH', 'quote_currency': 'USD', 'base_min_size': '0.01', 'base_max_size': '1000000', 'quote_increment': '0.01', 'display_name': 'ETH/USD'}}, 'LTC/BTC': {'id': 'LTC-BTC', 'symbol': 'LTC/BTC', 'base': 'LTC', 'quote': 'BTC', 'info': {'id': 'LTC-BTC', 'base_currency': 'LTC', 'quote_currency': 'BTC', 'base_min_size': '0.01', 'base_max_size': '1000000', 'quote_increment': '0.00001', 'display_name': 'LTC/BTC'}}, 'LTC/USD': {'id': 'LTC-USD', 'symbol': 'LTC/USD', 'base': 'LTC', 'quote': 'USD', 'info': {'id': 'LTC-USD', 'base_currency': 'LTC', 'quote_currency': 'USD', 'base_min_size': '0.01', 'base_max_size': '1000000', 'quote_increment': '0.01', 'display_name': 'LTC/USD'}}, 'ETH/EUR': {'id': 'ETH-EUR', 'symbol': 'ETH/EUR', 'base': 'ETH', 'quote': 'EUR', 'info': {'id': 'ETH-EUR', 'base_currency': 'ETH', 'quote_currency': 'EUR', 'base_min_size': '0.01', 'base_max_size': '1000000', 'quote_increment': '0.01', 'display_name': 'ETH/EUR'}}}
>>> gdax.create_limit_buy_order ('BTC/USD', 1, 2000)
gdax POST https://api-public.sandbox.gdax.com/orders 400 Bad Request b'{"message":"Insufficient funds"}'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/igorkroitor/ccxt/ccxt/__init__.py", line 504, in create_limit_buy_order
    return self.create_order (product, 'limit', 'buy', amount, price, params)
  File "/Users/igorkroitor/ccxt/ccxt/__init__.py", line 6422, in create_order
    return self.privatePostOrders (self.extend (order, params))
  File "/Users/igorkroitor/ccxt/ccxt/__init__.py", line 6448, in request
    return self.fetch (url, method, headers, body)
  File "/Users/igorkroitor/ccxt/ccxt/__init__.py", line 207, in fetch
    response = opener.open (request, timeout = int (self.timeout / 1000))
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

from ccxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.