Send orders to a service using Amibroker

Hi,

My broker provides API for sending orders to exchange. I am planning to write a service which acts as a middle man which uses API provided by broker and send orders to exchange automatically. Now I have my strategy written using AFL. During live market Amibroker should be able to send signals (orders) to my service. Is there a way to do that ?

I am basically here looking for a direction. Should I need to take a plugin approach? Can you please point to any article or code related to sending orders to a service. I don't mind to learn any technology since I am already a developer.

I am totally stuck.. Please show me some direction. Any help would be much appreciated.

Thanks and Regards,
Vinay

API is a very general term, you should be specific or share a link to their docs. Its that simple.

Are those multi-language APIs, have they got C++ APIs, are they REST or HTTP(Get/Post)… can be a lot of them you see ?
I'm highlighting this because you're already a developer so no lame excuse :stuck_out_tongue:

Anyway, if they have C++ APIs and you're good at it, then DLL is the way to go but this is Advanced.
This would also most likely mean their desktop app runs locally.

If they are remote servers directly communicating, then you can achieve your task with fair simplicity using a COM Server, you can run it in any language that you like which supports it.

If they are HTTP simple GET, you could even fire directly from AFL with the Internet functions.

Some APIs are not in C++ but other managed languages Python / C# or PHP in which case they expect you to right your own Local app.

Although this is Python specific and topic digresses in between, there are a few topics you can search for in the forum.

Base your searches (Google) on COM Server and you'll get a lot of links.

3 Likes

Thanks for your input. The broker which I am referring to provides different kinds of APIs, They also provide Rest Based API. So can I make calls to REST based APIs in AFL.

Here is the broker API which I was referring to. May be I can write a simple WEB API service using .NET Core and call this broker API for placing trades to exchange. But how to make Amibroker and the service which I newly write communicate ? Amibroker have to send signals to the service and service can take care of rest of the stuffs like calling broker API, sending orders etc...

COM is definitely an option here, But is there a better way ? I have read somewhere that if COMS used in Amibroker then it doesn't support Multi threading (I may be wrong here, @Tomasz can comment on that part).

ttps://upstox.com/developer/api/v1/docs/

You will get detailed answers once you start posting specific queries, till then there will be a lot of ifs and buts.

COM is definitely old and is advised in many places to be avoided but all ultimately depends on your requirement too.
What you read "somewhere" is explained in detail here http://www.amibroker.com/guide/h_multithreading.html

You don't even say whether you intend to fire 10-20 orders a day or HFT like 5 order per second. Got what i'm saying ?
Now you'll know where COM can and cant work. The same > vice-versa, if an option can serve the purpose spending 1 day of time, why build another that would take a week?

1 Like

http://www.amibroker.com/at/

2 Likes

Thanks @travick. Yes maximum 15 to 20 orders, will not exceed that.. HFT no way... You are right about question should be more specific. Will try to be more specific.

@Milosz Thanks I will take a look...

Hi Vinay
Have you found any solution to amibroker to upstox bridge. Please advise. WhatsApp 8527245777

Upstox provides REST API.

All REST APIs are nothing more than web services available over HTTP and can be accessed directly from AFL using internet functions
http://www.amibroker.com/f?internetopenurl
http://www.amibroker.com/f?internetpostrequest

They also seem to have their own bridge for AmiBroker https://upstox.com/products/amibroker-afl-bridge/

I did not test it though so don't take this as any endorsement

Hi VInay, have you had any success on this ? Thanks

Hi , I am doing same thing for my broker api , using afl plugin

Hi junjun, Would you be able to provide some guidance please ?

You can read the ADK from web site of Amibroker office web.
from here :

http://www.amibroker.com/bin/ADK.zip

send order have twe way to do this job , one is OLE , like IBcontroller , and the second way is use afl plugin ,

i an using the afl plugin , because i can't debug in OLE mode . and i can write the afl plugin in VC++

so .. by the way , You can choose a method that you can do better or familiar with