We will learn how to connect OsEngine to ATPlatform.
ATPlatform is an API and a terminal available with many brokers in China and beyond. Through it, you can trade SHFE, INE, HKEX, CME, COMEX, NYMEX, GME, ICE-Europe, ICE-US, ICE-UK, SGX, CFFEX, SHFE, ZCE, DCE, etc.
Website: http://www.atplatform.com.cn
This is an IT company operating in the finance and trading sector since 2005. If you visit their website, you can see their main products in the header:
1. Trading system - referring to their main terminal, ATPlatform. Everything else is built around it.
2. Market Making system.
3. Fund program.
4. Commodity markets program.
5. Settlement system - likely for payments.
6. Trading console.
On the "About us" page, you can find a timeline of the company's development:
From which we can conclude that they have been operating since 2005 and transitioned into cryptocurrency since 2018.
How to apply for a demo account?
To try their terminal, you can visit this page.
However, it only accepts Chinese phone numbers for registration, so you need to email them requesting a demo:
*Write in English.
Something like:
"Hello.
Regarding the demo account. I would like to try your ATPlatform terminal and connect my trading robots to it. Please provide the distribution and connection details.
Best regards,"
Mandatory connection details for the API.
When connecting through a broker or demo, you should have the following list of details:
1. Broker ID: - Your broker's ID.
2. User ID: - User ID.
3. User password: - User password.
4. Data server URL: tcp://demo9.atplatform.cn:41213 – data server connection address.
5. Trade server URL: tcp://demo9.atplatform.cn:40905 – trading server connection address.
ATPlatform terminal. How to view tradable instruments.
Once you install the terminal and connect, consider a few important nuances regarding the instruments. You need to know their exact names in the terminal to input them later in OsEngine. To do this, go to the terminal and the "Market Price" window:
1. Right-click in the "Market Price" window.
2. Click on "Add Contract."
A contract selection window will open where you need to connect ALL the instruments you want to trade later.
Connecting to ATPlatform from OsEngine.
When you open the program, go to Bot Station Light:
Next, you will connect the connector:
1. Go to the available connections tab.
2. Select Atp. Double-click on it.
The connection window for the connector will open:
1. Broker ID - provided by the broker.
2. User ID - provided by the broker.
3. User password - provided by the broker.
4. Data server URL - demo is inserted by default.
5. Trade server URL - demo is inserted by default.
6. Securities button - this opens the settings window for tradable instruments. We will take a closer look at how to set up instruments later.
7. Auth on/off - whether authorization is enabled on the broker's server. By default, it is off. If the broker requires authorization, you need to send them the program name: "wangosengine1.8.2" and set this option to True. The broker will add the program name to their core, and the certificate (which we have) will be automatically verified.
8. Activate routers - which routers will be deployed.
a. Trade+Data - both trading and data.
b. Trade - trading only, without data.
c. Data - only data.
After configuring the connector and connecting it, you can start trading.
Sources. Architecture of connection, router. And how does C++ relate?
When connecting to ATP, you will see two routers (console applications) on your screen. These are modernized C++ examples provided with the demo:
These programs are stored in this folder, next to the OsEngine exe file.
IMPORTANT! You will need to disable antivirus software and other firewalls...
During the deployment of routers, Windows may encounter "security issues." You will need to disable them.
The source code for the connection can be found here:
Good luck with your algorithms!