What is SP Native API

SP NATIVE API is a dynamic-link library (.dll file) provided by Sharppoint Limited. It replaces the legacy auto trading platform called Trader API. SP Native API currently supports 32-bit and 64-bit Windows and 64-bit Linux.

Any program can call the functions stored in this dll file. In particular, you can use dll to login to a broker’s server which supports such a feature. Not all brokers supporting SPTrader supports SP Native API. It requires their firms to setup a special server machine to support this.   Also, when you login to SP Native API, besides the usual User ID and password, you need to enter a particular pair of strings called “APP ID” and “API License“.  Some brokers charge you for these, while others, like Quam Capital, provide it for FREE.

Since this dll library logins to the server on behalf of your program, you must provide some call back functions for the dll to call when it receives replies from the server. E.g. you need to provide call back functions for handing Tickers, Quotes data feed and replies to Orders being placed or executed.

Your program needs to have a separate thread to run the dll, otherwise, it will freeze at times when the dll is waiting or handling replies from the server. Similarly, while your program is handling user interactions or updating the screen, data feeds and replies from SP Native API will be blocked and delayed.  As a result, multi-threading programming is a must in using SP Native API.  However, Mutli-threaded asynchronous programs are tricky to write.  There are examples programs at the Sharp Point’s web site but none is multi-threaded.   If you want to your own program to function like SPTrader, you must use multi-threads. Only if you do not need a user interface, a single thread program which runs an infinite loop of poll will then work.

If you don’t have time to write your own program, try out this Spark, which was written to use SP Native API to replace SPTrader and do automatic program trading.