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.

gemini create order not working

See original GitHub issue

i was able to query the balance successfully, which means the API key is working. The API key has trading priority as well. here is the code snippet

gemini_balance = gemini.fetch_balance()
print 'gemini', gemini_balance['BTC']['total'], gemini_balance['USD']['total'] # success
time.sleep(2)
gemini.create_order('BTC/USD', 'limit', 'sell', 0.1, 6350) # got ccxt.base.errors.ExchangeNotAvailable

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
duduwithmagiccommented, Nov 1, 2017

i found the cause. all you need to do is changing the line marked with ####

def create_order(self, symbol, type, side, amount, price=None, params={}): self.load_markets() if type == ‘market’: raise ExchangeError(self.id + ’ allows limit orders only’) order = { ‘client_order_id’: str(self.nonce()), #### add str() ‘symbol’: self.market_id(symbol), ‘amount’: str(amount), ‘price’: str(price), ‘side’: side, ‘type’: ‘exchange limit’, # gemini allows limit orders only } print order response = self.privatePostOrderNew(self.extend(order, params)) return { ‘info’: response, ‘id’: response[‘order_id’], }

On Wed, Nov 1, 2017 at 12:24 AM, Igor Kroitor notifications@github.com wrote:

@hzmbeyond80 https://github.com/hzmbeyond80 thx! I’ll take a look into it and will get back to you asap!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ccxt/ccxt/issues/436#issuecomment-341016386, or mute the thread https://github.com/notifications/unsubscribe-auth/AE19PQGhoJGX9E0eYrM8BwRT3qKe4vBCks5syByhgaJpZM4QN0-J .

1reaction
duduwithmagiccommented, Nov 1, 2017
('https://api.gemini.com/v1/order/new', 'POST', 'https://api.gemini.com/v1/order/new', '\nRequest:', {'X-GEMINI-SIGNATURE': '9ec27cc961ba36ffcf77a1bddbd75bbe2240a47467b191f43f8fafbe7c364f152b073cc47744fa8bf5dc1548f6afe845', 'X-GEMINI-PAYLOAD': 'eyJub25jZSI6MTUwOTUyMDc0Niwic3ltYm9sIjoiYnRjdXNkIiwicmVxdWVzdCI6Ii92MS9vcmRlci9uZXciLCJjbGllbnRfb3JkZXJfaWQiOjE1MDk1MjA3NDYsImFtb3VudCI6IjAuMSIsInR5cGUiOiJleGNoYW5nZSBsaW1pdCIsInByaWNlIjoiNjM1MCIsInNpZGUiOiJzZWxsIn0=', 'Accept-Encoding': 'gzip, deflate', 'X-GEMINI-APIKEY': 'KuNk8fnPp8QwfHuu9ADM', 'Content-Type': 'text/plain', 'User-Agent': 'ccxt/1.9.307 (+https://github.com/ccxt-dev/ccxt) Python/2.7.10'}, None)
Traceback (most recent call last):
  File "/Users/zhiminhe/Dropbox/BitcoinPYVersions/BitCoinPYPython2.0/btc_action_jp_us.py", line 63, in <module>
    print gemini.create_order('BTC/USD', 'limit', 'sell', 0.1, 6350)
  File "/Users/zhiminhe/Dropbox/BitcoinPYVersions/BitCoinPYPython2.0/ccxt/gemini.py", line 162, in create_order
    response = self.privatePostOrderNew(self.extend(order, params))
  File "/Users/zhiminhe/Dropbox/BitcoinPYVersions/BitCoinPYPython2.0/ccxt/gemini.py", line 198, in request
    response = self.fetch2(path, api, method, params, headers, body)
  File "/Users/zhiminhe/Dropbox/BitcoinPYVersions/BitCoinPYPython2.0/ccxt/base/exchange.py", line 235, in fetch2
    return self.fetch(request['url'], request['method'], request['headers'], request['body'])
  File "/Users/zhiminhe/Dropbox/BitcoinPYVersions/BitCoinPYPython2.0/ccxt/base/exchange.py", line 288, in fetch
    self.handle_rest_errors(e, e.code, text, url, method)
  File "/Users/zhiminhe/Dropbox/BitcoinPYVersions/BitCoinPYPython2.0/ccxt/base/exchange.py", line 331, in handle_rest_errors
    self.raise_error(error, url, method, exception if exception else http_status_code, details)
  File "/Users/zhiminhe/Dropbox/BitcoinPYVersions/BitCoinPYPython2.0/ccxt/base/exchange.py", line 220, in raise_error
    details,
ccxt.base.errors.ExchangeNotAvailable: gemini POST https://api.gemini.com/v1/order/new 400 Bad Request  (possible reasons: invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting, )

Process finished with exit code 1
Read more comments on GitHub >

github_iconTop Results From Across the Web

Gemini FIX Order Entry API Reference
Symbol Minimum Order Size Tick Size Quote Currency Price Increment btcusd 0.00001 BTC (1e‑5) 0.00000001 BTC (1e‑8) 0.01 USD btceur 0.00001 BTC (1e‑5) 0.00000001 BTC...
Read more >
Gemini Exchange Status
Welcome to Gemini Exchange's home for real-time and historical data on system performance.
Read more >
Trading Basics: Market Orders, Limit Orders, & More | Gemini
Learn about cryptocurrency trading and the basic trading order types, including: market orders, limit orders, and stop-loss orders.
Read more >
Gemini REST API Reference
Troubleshooting. Please use our Sandbox environment to develop and test your code. If your private API request is failing, turn on debug logging...
Read more >
Gemini WebSocket API Reference
For public WebSocket APIs, we recommend that you do not exceed 1 request per symbol ... Order Status endpoint for the same order,...
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