159 lines
4.3 KiB
C
159 lines
4.3 KiB
C
|
/////////////////////////////////////////////////////////////////////////
|
|||
|
///@author <20><>̩֤ȯ<D6A4>ɷ<EFBFBD><C9B7><EFBFBD><EFBFBD><EFBFBD>˾
|
|||
|
///@file xtp_quote_api.h
|
|||
|
///@brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鶩<EFBFBD>Ŀͻ<C4BF><CDBB>˽ӿ<CBBD>
|
|||
|
/////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
#ifndef _XTP_QUOTE_API_H_
|
|||
|
#define _XTP_QUOTE_API_H_
|
|||
|
|
|||
|
#if _MSC_VER > 1000
|
|||
|
#pragma once
|
|||
|
#endif // _MSC_VER > 1000
|
|||
|
|
|||
|
#include "xtp_api_struct.h"
|
|||
|
|
|||
|
#if defined(ISLIB) && defined(WIN32)
|
|||
|
#ifdef LIB_MD_API_EXPORT
|
|||
|
#define MD_API_EXPORT __declspec(dllexport)
|
|||
|
#else
|
|||
|
#define MD_API_EXPORT __declspec(dllimport)
|
|||
|
#endif
|
|||
|
#else
|
|||
|
#define MD_API_EXPORT
|
|||
|
#endif
|
|||
|
|
|||
|
/*!
|
|||
|
* \class XTP::API::QuoteSpi
|
|||
|
*
|
|||
|
* \brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* \author <EFBFBD><EFBFBD>̩֤ȯ<EFBFBD>ɷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾
|
|||
|
* \date ʮ<EFBFBD><EFBFBD> 2015
|
|||
|
*/
|
|||
|
namespace XTP {
|
|||
|
namespace API {
|
|||
|
class QuoteSpi
|
|||
|
{
|
|||
|
public:
|
|||
|
|
|||
|
///<2F><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>뽻<EFBFBD><EFBFBD>̨ͨ<CCA8><CDA8><EFBFBD><EFBFBD><EFBFBD>ӶϿ<D3B6>ʱ<EFBFBD><CAB1><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
|||
|
///@remark <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ֧<CEB4><D6A7>
|
|||
|
///@param reason <20><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|||
|
virtual void OnDisconnected(int reason) {};
|
|||
|
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
|||
|
///@param error_info <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
virtual void OnError(XTPRI *error_info) {};
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
|||
|
///@param ticker <20><>ϸ<EFBFBD>ĺ<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@param error_info <20><><EFBFBD>ĺ<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
///@param is_last <20>Ƿ<EFBFBD><C7B7>˴ζ<CBB4><CEB6>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ӧ<EFBFBD><D3A6>
|
|||
|
///@remark ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD>ĵĺ<C4B5>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>Ӧһ<D3A6><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
|||
|
virtual void OnSubMarketData(XTPST *ticker, XTPRI *error_info, bool is_last) {};
|
|||
|
|
|||
|
///ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
|||
|
///@param ticker <20><>ϸ<EFBFBD>ĺ<EFBFBD>Լȡ<D4BC><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@param error_info <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
///@param is_last <20>Ƿ<EFBFBD><C7B7>˴<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ӧ<EFBFBD><D3A6>
|
|||
|
///@remark ÿ<><C3BF>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ĵĺ<C4B5>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>Ӧһ<D3A6><D2BB>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
|||
|
virtual void OnUnSubMarketData(XTPST *ticker, XTPRI *error_info, bool is_last) {};
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD>֪ͨ
|
|||
|
///@param market_data <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
virtual void OnMarketData(XTPMD *market_data) {};
|
|||
|
|
|||
|
|
|||
|
///<2F><>ѯ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ԼӦ<D4BC><D3A6>
|
|||
|
///@remark <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><CBBA><EFBFBD><EFBFBD><EFBFBD>δ֧<CEB4><D6A7>
|
|||
|
virtual void OnQueryAllTickers() {};
|
|||
|
};
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*!
|
|||
|
* \class XTP::API::QuoteApi
|
|||
|
*
|
|||
|
* \brief <EFBFBD><EFBFBD><EFBFBD>鶩<EFBFBD>Ľӿ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* \author <EFBFBD><EFBFBD>̩֤ȯ<EFBFBD>ɷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾
|
|||
|
* \date ʮ<EFBFBD><EFBFBD> 2015
|
|||
|
*/
|
|||
|
namespace XTP {
|
|||
|
namespace API {
|
|||
|
class MD_API_EXPORT QuoteApi
|
|||
|
{
|
|||
|
public:
|
|||
|
///<2F><><EFBFBD><EFBFBD>QuoteApi
|
|||
|
///@param save_file_path <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶΣ<D6B6><CEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ŀ¼<C4BF><C2BC>Ĭ<EFBFBD><C4AC>Ϊ<EFBFBD><CEAA>ǰĿ¼
|
|||
|
///@return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UserApi
|
|||
|
static QuoteApi *CreateQuoteApi(const char *save_file_path = "");
|
|||
|
|
|||
|
///ɾ<><C9BE><EFBFBD>ӿڶ<D3BF><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@remark <20><><EFBFBD><EFBFBD>ʹ<EFBFBD>ñ<EFBFBD><C3B1>ӿڶ<D3BF><DAB6><EFBFBD>ʱ,<2C><><EFBFBD>øú<C3B8><C3BA><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ӿڶ<D3BF><DAB6><EFBFBD>
|
|||
|
virtual void Release() = 0;
|
|||
|
|
|||
|
|
|||
|
///<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@return <20><>ȡ<EFBFBD><C8A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@remark ֻ<>е<EFBFBD>¼<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>,<2C><><EFBFBD>ܵõ<DCB5><C3B5><EFBFBD>ȷ<EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
virtual const char *GetTradingDay() = 0;
|
|||
|
|
|||
|
|
|||
|
///ע<><D7A2><EFBFBD>ص<EFBFBD><D8B5>ӿ<EFBFBD>
|
|||
|
///@param spi <20><><EFBFBD><EFBFBD><EFBFBD>Իص<D4BB><D8B5>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|||
|
virtual void RegisterSpi(QuoteSpi *spi) = 0;
|
|||
|
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>顣
|
|||
|
///@return <20><><EFBFBD>Ľӿڵ<D3BF><DAB5><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD>ӿڵ<D3BF><DAB5>óɹ<C3B3><C9B9><EFBFBD><EFBFBD>ǡ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD>ӿڵ<D3BF><DAB5>ó<EFBFBD><C3B3><EFBFBD>
|
|||
|
///@param ticker <20><>ԼID<49><44><EFBFBD><EFBFBD>
|
|||
|
///@param count Ҫ<><D2AA><EFBFBD><EFBFBD>/<2F>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>
|
|||
|
///@param exchage_id <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@remark <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>ͬһ֤ȯ<D6A4><C8AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>Լ
|
|||
|
virtual int SubscribeMarketData(char *ticker[], int count, XTP_EXCHANGE_TYPE exchage_id) = 0;
|
|||
|
|
|||
|
///<2F>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>顣
|
|||
|
///@return ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD>Ľӿڵ<D3BF><DAB5><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD>ӿڵ<D3BF><DAB5>óɹ<C3B3><C9B9><EFBFBD><EFBFBD>ǡ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD>ӿڵ<D3BF><DAB5>ó<EFBFBD><C3B3><EFBFBD>
|
|||
|
///@param ticker <20><>ԼID<49><44><EFBFBD><EFBFBD>
|
|||
|
///@param count Ҫ<><D2AA><EFBFBD><EFBFBD>/<2F>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>
|
|||
|
///@param exchage_id <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@remark <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ֤ȯ<D6A4><C8AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>Լ
|
|||
|
virtual int UnSubscribeMarketData(char *ticker[], int count, XTP_EXCHANGE_TYPE exchage_id) = 0;
|
|||
|
|
|||
|
///<2F>û<EFBFBD><C3BB><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
|
|||
|
///@return <20><>¼<EFBFBD>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>¼<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>-1<><31><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-2<><32><EFBFBD><EFBFBD>ʾ<EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>logout<75><74><EFBFBD><EFBFBD>-3<><33><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>
|
|||
|
///@param ip <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
///@param port <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF>
|
|||
|
///@param user <20><>½<EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
|||
|
///@param password <20><>½<EFBFBD><C2BD><EFBFBD><EFBFBD>
|
|||
|
///@param sock_type <20><>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TCP<43><50><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UDP<44><50>Ŀǰ<C4BF><C7B0>ʱֻ֧<D6BB><D6A7>TCP
|
|||
|
///@remark <20>˺<EFBFBD><CBBA><EFBFBD>Ϊͬ<CEAA><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>첽<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>¼<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC>ɽ<EFBFBD><C9BD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
virtual int Login(const char* ip, int port, const char* user, const char* password, XTP_PROTOCOL_TYPE sock_type) = 0;
|
|||
|
|
|||
|
|
|||
|
///<2F>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@return <20>dz<EFBFBD><C7B3>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD>dz<EFBFBD><C7B3>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>ǡ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@remark <20>˺<EFBFBD><CBBA><EFBFBD>Ϊͬ<CEAA><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>첽<EFBFBD>ȴ<EFBFBD><C8B4>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC>ɽ<EFBFBD><C9BD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
virtual int Logout() = 0;
|
|||
|
|
|||
|
///<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>տɽ<D5BF><C9BD><EFBFBD>Լ
|
|||
|
///@return <20><>ѯ<EFBFBD>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ѯ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>ǡ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ѯ<EFBFBD><D1AF><EFBFBD>ɹ<EFBFBD>
|
|||
|
///@param exchage_id <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///@remark <20>˺<EFBFBD><CBBA><EFBFBD><EFBFBD><EFBFBD>δ֧<CEB4><D6A7>
|
|||
|
virtual int QueryAllTickers(XTP_EXCHANGE_TYPE exchage_id) = 0;
|
|||
|
|
|||
|
|
|||
|
protected:
|
|||
|
~QuoteApi() {};
|
|||
|
};
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#endif
|