#pragma once

#include "spdOrderAPI.h"

class testSpdOrderAPI : public spdOrderAPI
{
private:
	bool isLogon{ false };
	bool exit{ false };
protected:
	void OnSpeedyConnected() override;
	void OnSpeedyDisconnected() override;
	void OnSpeedyLogonResponse(bool isLoginOK, const char* ReplyMsg) override;
	void OnNewOrderReport(long long nid, const char* UDD, const char* Symbol, double Price, const char* Side, long OrderQty, const char* OrderType, const char* TimeinForce, const char* OrderID) override;
	void OnCancelOrderReport(long long nid, const char* UDD, const char* Symbol, double Price, const char* Side, const char* OrderID) override;
	void OnReplaceOrderReport(long long nid, const char* UDD, const char* Symbol, double Price, const char* Side, long OrderQty, const char* OrderType, const char* TimeinForce, const char* OrderID) override;
	void OnOrderRejectedReport(long long nid, const char* UDD, const char* ActionFrom, const char* ErrCode, const char* ErrMsg) override;
	void OnOrderMatchReport(long long nid, const char* UDD, const char* OrderID, long ReportSeq, double MatchPrice, long MatchQty, const char* MatchTime) override;

private:
	void cmdNewOrder();
	void cmdCancelOrder();
	void cmdNewForeignOrder();
	void cmdCancelForeignOrder();
	void cmdReplaceOrder();
	void cmdMakeStockAccountInquriy();
	void cmdQueryStkOrder();
	void cmdQueryStkMatch();
	void cmdQueryFutOrder();
	void cmdQueryFutMatch();
	void cmdQueryFutUncoverRT();
	void cmdQueryFutMargin();
	void cmdChangePassword();
	void cmdQueryForeignStockInventory();
	void cmdQueryForeignStockOrder();
	void cmdQueryForeignStockFilled();
	void cmdDownloadForeignStockProductData();
	void cmdDownloadForeignStockCurrencyData();
	void cmdDownloadForeignStockMarketData();
	void cmdGetKChartData(int index);

public:
	void MainLoop();
};

