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

Insufficient funds error using "/v3/batchorders" #173

Open
sossee2 opened this issue Oct 10, 2019 · 7 comments
Open

Insufficient funds error using "/v3/batchorders" #173

sossee2 opened this issue Oct 10, 2019 · 7 comments

Comments

@sossee2
Copy link

sossee2 commented Oct 10, 2019

I'm trying to implement a "Replace Order" where I cancel an existing order and place a similar order with a different price using the /v3/batchorders endpoint and passing in the order to cancel as well as the order to replace it with. However I get an insufficient funds error which tells me that the engine is trying to place the new order before cancelling the old one (I do not have enough funds for both). I would think the batchorders function should process the cancel orders first however that doesn't seem to be the case.

@martin-nginio
Copy link
Contributor

Hi @sossee2

Thanks for your feedback.

I can confirm that with the current implementation it's possible that you can get "insufficient funds" error when the entire fund is used in one of the batch items and this is due to order processing and cancellation operations being asynchronous in our end.

I understand this could be an issue for your use case, so let me review this and will get back to you in the next few days with a solution or workaround. We want to support a variety of trading strategies, so we should try to cover such use cases.

On a related note, I also wanted to mention that the following request format should be helpful for your use case (cancelling an existing order and then creating a new one) but you may already have used this format.

[{"cancelOrder":{"orderId":"12345"}},{"placeOrder":{"marketId":"XRP-AUD","side":"Bid","type":"Limit","price":"0.22","amount":"0.26","clientOrderId":"abc-28"}}]

In above sample, the existing order with orderId 12345 is cancelled and a new order with clientOrderId of abc-28 will be created.

Thanks.

Regards,
Martin

@sossee2
Copy link
Author

sossee2 commented Oct 12, 2019

Thanks Martin, that is indeed what I've been using. I think this is an important feature but understand the challenges in it's implementation.

@martin-nginio
Copy link
Contributor

Hi @sossee2

Thanks for your patience and my apologies for not getting back to you sooner.

Allowing batch orders to consume funds released in the same batch is now active with our dev team and we are aiming to finalize it in 2 weeks time (by November 8th).

I"m hoping this is not blocking your development for now.

Thanks.

Regards,
Martin

@sossee2
Copy link
Author

sossee2 commented Oct 24, 2019

Glad to hear Martin, thanks.

@martin-nginio
Copy link
Contributor

Hi @sossee2

We have made some progress and our team is currently performing final test.

Please can you run your same case again (simulating replace order) and let us know if you are still getting insufficient fund.

Thanks for your help.

Regards,
Martin

@sossee2
Copy link
Author

sossee2 commented Jan 11, 2020

Hey Martin,

I don't appear to be getting any more insufficient funds errors in testing however when I release this into the wild I am getting throttled too hard to really tell. In fact I've had to turn off the feature as the API limits for batch orders are 6 times more restrictive than the regular ones. Given I'm only using batch orders to "replace" my existing orders, this isn't a good enough pay off for me personally. Is it possible to get the batch order API limits be modified so that it matches order placement? Let me know if you want me to raise a seperate ticket.

@martin-nginio
Copy link
Contributor

Hi @sossee2

Thanks for your patience.

We should be able to help you with throttling so please can you create a ticket with our help desk and they can lookup your account and help.

Thanks.

Regards,
Martin

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