Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HitBTC market buy/sell order fails #314

Closed
Fcl69 opened this issue Oct 12, 2017 · 3 comments
Closed

HitBTC market buy/sell order fails #314

Fcl69 opened this issue Oct 12, 2017 · 3 comments
Assignees

Comments

@Fcl69
Copy link

Fcl69 commented Oct 12, 2017

Hi,

here is my code:

import ccxt
hitbtc = ccxt.hitbtc({
    "apiKey": "key",
    "secret": "secret",
    "verbose": True,
})
print(hitbtc.create_market_sell_order('BTC/USD', 0.01))

ccxt fails...

PS Key & nonce is fine, I can pull balance data, for example.

@kroitor kroitor self-assigned this Oct 12, 2017
kroitor added a commit that referenced this issue Oct 12, 2017
@kroitor
Copy link
Member

kroitor commented Oct 12, 2017

Hi, @Fcl69!
I've uploaded a slightly edited version of it... can you please try it again and report? It should work now.
Cheers!

@Fcl69
Copy link
Author

Fcl69 commented Oct 12, 2017

It did work! Thank you!

@Fcl69 Fcl69 closed this as completed Oct 12, 2017
@kroitor
Copy link
Member

kroitor commented Oct 12, 2017

@Fcl69 ok, but, please, be aware, that there's a little more to it:

  1. HitBTC has a timeInForce order parameter, that is a setting that controls the execution of the order (how HitBTC should treat and fill the order):
GTC (Good-Til-Canceled): the order will stay open or partially closed until filled or canceled by user
IOC (Immediate-Or-Cancel): the order will either fill immediately or will be canceled automatically
FOK (Fill-Or-Kill): the order will either be filled entirely or will expire
DAY (Day): the order will either be filled in 24 hours or will expire
GTD (Good Till Date): the order will expire on specific date
  1. The default execution type for limit orders in HitBTC and ccxt is GTC.

  2. For market orders HitBTC allows IOC or FOK only. The default in HitBTC and ccxt is FOK.
    If you need IOC execution, then you should pass that as an extra param with your order, like so:

hitbtc.create_market_sell_order('BTC/USD', 0.01) # default
hitbtc.create_market_sell_order('BTC/USD', 0.01, { 'timeInForce': 'FOK' }) # default
hitbtc.create_market_buy_order('BTC/USD', 0.01, { 'timeInForce': 'IOC' })

hitbtc.create_limit_sell_order('BTC/USD', 0.01) # default
hitbtc.create_limit_sell_order('BTC/USD', 0.01, { 'timeInForce': 'GTC' }) # default
hitbtc.create_limit_buy_order('BTC/USD', 0.01, { 'timeInForce': 'IOC' })

Let us know if you have any questions or difficulties left. Thx!

@kroitor kroitor changed the title HitBTC buy/sell order fails HitBTC market buy/sell order fails Oct 13, 2017
academe-01 pushed a commit to academe-01/ccxt that referenced this issue Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants