General API Questions/Thoughts

Hello,

I have been working with the API for a while now in Python - but had come to have a few questions (and possible feedback) about its implementation. So any clarification would be very helpful to myself, possibly others looking into getting into the API, and might reduce frustration when reading the API.

One question I have is in regards to the request methods built around it. I initially only gave the API doc a glance over when first starting to know the basics of what I needed - however further reading and more implementation done I realized the API is only post/get requests - even for something like modifying or deleting orders. Is there a reason for this instead of using other (more appropriate, in my opinion) request methods such as “put”, “delete”, “patch”, etc? I understand this would mean possibly changing the API to include things such order ID in the URL, for instance, to do things with put and delete - but I think this would clean up the API. Things like placing and order could have the account ID placed in the URL rather than inside the request body itself, for instance. Same with getting accounts, and a variety of other endpoints that could possibly be reduced down.

Another question I have is in regards to the domain endpoints. The separation of demo and live account accessibility through their respective endpoints - for instance - I can understand the separation, but it seems like it would be easier to write around if they were combined. Is there a reason for separation? Also, what is the demo-md domain for? I was unable to place orders and get account details (live and demo) from the md websocket and HTTP requests. So assuming it purely is only for “market data of demo account” - is there a reason to have/need/use both?

Finally, and this one is more for myself - but could very much help others - I haven’t found anything specific in the API docs yet about getting saved indicators. Is this implemented, such that I could get SMA, for instance? Or are these things we have to calculate on our own(like P/L) by getting older charts and doing the math?

Thanks for answering any or all questions,
Ryan

(Quick note: I’ve posted all these questions in one topic because I wasn’t sure if I should make three separate topics back-to-back)

Hello @WinterSnake,

Regarding the format of our REST API, the goal is simply to be format agnostic in terms of the HTTP method used. We do have endpoints that require query parameters, as well as others that require a JSON body, but the method used is not strictly enforced.

We separate the domains for a few reasons -

  • modularity, because you may not need to use every single endpoint that we offer across all domains
  • usage, some domains are for websocket connections, others are for standard REST ops, and there is a domain for market replay as well.

Regarding indicators, this is a feature of the Trader application and you cannot get the results of Trader indicators using the API, you will have to do the math manually using the getChart endpoint and sorting the data as necessary. You can read about getChart here.

Best of luck!

Hi,

Thanks for the quick reply! So to be clear, any request method including things like put/delete would be allowed through the API? I’ll do some testing just to make sure, and I don’t mind sticking to post/get either in terms of keeping with the API docs. Just wanted clarity.

As for domains, yeah that makes sense -I just wasn’t sure the use of demo-md (though maybe it’s for market replay and that’s why I haven’t caught on, it’s not a feature I use).

And indicators - thanks for the clarification. After not reading about any built-in endpoint for it, I figured we’d need to use getChart. I already implemented basic indicators through this method already, I just wasn’t sure if I missed the obvious way to get it.

Thanks again,
Ryan