|
ATS
An algorithmic trading system completely written in C++
|
The BinanceExchangeManager class is a class that defines the interface for managing orders on the Binance exchange. More...
#include <BinanceExchangeManager.h>
Public Member Functions | |
| BinanceExchangeManager (OrderManager &orderManager, bool isSimulation=true, time_t updateInterval=1, std::string apiKey="", std::string secretKey="") | |
| Constructor for BinanceExchangeManager class. More... | |
| ~BinanceExchangeManager () | |
| Destructor for BinanceExchangeManager class. | |
| void | start () |
| Start the BinanceExchangeManager thread. | |
| void | run () |
| The BinanceExchangeManager processing function. | |
| void | stop () |
| Stop the BinanceExchangeManager thread. | |
| bool | isRunning () |
| Check if the BinanceExchangeManager thread is running. More... | |
| bool | isSimulation () |
| Check if the EMS is connected to the test network. More... | |
| void | updateOpenOrders () |
| Update open orders on the local OMS. | |
| double | sendOrder (Order &order) override |
| Send an order to the Binance exchange. More... | |
| void | modifyOrder (Order &oldOrder, Order &newOrder) override |
| Modify an existing order on the Binance exchange. More... | |
| void | cancelOrder (long orderId, std::string symbol) |
| Cancel an existing order on the Binance exchange. More... | |
| void | cancelOrder (Order &order) override |
| Cancel an existing order on the Binance exchange. More... | |
| void | getOrderStatus (Order &order, Json::Value &result) override |
| Gets the status of the given order. More... | |
| std::vector< Order > | getOpenOrders (std::string symbol="") override |
| Gets all open orders for the current user. More... | |
| std::vector< Trade > | getTradeHistory (std::string symbol) override |
| Gets the trade history for the specified symbol. More... | |
| double | getPrice (std::string symbol) override |
| Gets the current price for the specified symbol. More... | |
| void | getKlines (Json::Value &result, std::string symbol, std::string interval, time_t start_date=0, time_t end_date=0, int limit=500) override |
| Gets Klines for a symbol. More... | |
| Order | jsonToOrder (Json::Value &result) |
| Converts a JSON object to an Order object. More... | |
| Trade | jsonToTrade (Json::Value &result) |
| Converts a JSON object to a Trade object. More... | |
| void | getUserInfo (Json::Value &result) |
| Gets the current user's information. More... | |
| std::map< std::string, double > | getBalances () override |
| Gets user's balances. More... | |
| virtual OrderBook | getOrderBook (std::string symbol) override |
| Retrieves the order book. More... | |
Public Member Functions inherited from ats::ExchangeManager | |
| ExchangeManager (OrderManager &oms) | |
| Constructor for ExchangeManager class. More... | |
| virtual | ~ExchangeManager ()=default |
| Virtual destructor for ExchangeManager class. | |
Additional Inherited Members | |
Protected Attributes inherited from ats::ExchangeManager | |
| OrderManager & | mOrderManager |
The BinanceExchangeManager class is a class that defines the interface for managing orders on the Binance exchange.
|
explicit |
Constructor for BinanceExchangeManager class.
| orderManager | Reference to the OrderManager object. |
| isSimulation | A boolean indicating whether the exchange is a simulation or not. |
| updateInterval | Open orders update period. |
| api_key | The API key for the Binance exchange account. |
| secret_key | The secret key for the Binance exchange account. |
| void ats::BinanceExchangeManager::cancelOrder | ( | long | orderId, |
| std::string | symbol | ||
| ) |
Cancel an existing order on the Binance exchange.
| orderId | The orderId of the order to cancel. |
| symbol | The symbol of the order to cancel. |
|
overridevirtual |
Cancel an existing order on the Binance exchange.
| order | The Order to be cancelled. |
Implements ats::ExchangeManager.
|
overridevirtual |
|
overridevirtual |
Gets Klines for a symbol.
| result | Json object to write the response to |
| symbol | Symbol to get the Klines for |
| interval | Kline interval |
| start_date | Start date |
| end_date | End date |
| limit | Limit, should be less than or equal to 1000 |
Implements ats::ExchangeManager.
|
overridevirtual |
Gets all open orders for the current user.
| symbol | The symbol to retrieve the orders for, all open orders if omitted. |
Implements ats::ExchangeManager.
|
overridevirtual |
Retrieves the order book.
| symbol | The symbol to retrieve the order book for. |
Implements ats::ExchangeManager.
|
overridevirtual |
Gets the status of the given order.
| order | The order to check the status of. |
| result | The JSON object containing the result of the operation. |
Implements ats::ExchangeManager.
|
overridevirtual |
Gets the current price for the specified symbol.
| symbol | The symbol to get the price for. |
Implements ats::ExchangeManager.
|
overridevirtual |
Gets the trade history for the specified symbol.
| symbol | The symbol to get the trade history for. |
Implements ats::ExchangeManager.
| void ats::BinanceExchangeManager::getUserInfo | ( | Json::Value & | result | ) |
Gets the current user's information.
| result | The JSON object containing the result of the operation. |
| bool ats::BinanceExchangeManager::isRunning | ( | ) |
Check if the BinanceExchangeManager thread is running.
| bool ats::BinanceExchangeManager::isSimulation | ( | ) |
Check if the EMS is connected to the test network.
| Order ats::BinanceExchangeManager::jsonToOrder | ( | Json::Value & | result | ) |
| Trade ats::BinanceExchangeManager::jsonToTrade | ( | Json::Value & | result | ) |
|
overridevirtual |
Modify an existing order on the Binance exchange.
Implements ats::ExchangeManager.
|
overridevirtual |
Send an order to the Binance exchange.
| order | The Order object to be sent. |
Implements ats::ExchangeManager.