首先下载NanoAPI开发包,解压后进入hsnanodemo目录下,查看配置文件HsApiConfig.ini内容如下:
[fast]
###########################################
####### Network configurations ########
###########################################
# whether need to close epoll(), 1 indicates running without epoll()
TCPBusyMode=0
# Affinity CPU ID for thread to send/receive TCP trading order, -1 indicates no need to set CPU affinity
TCPTradingCPUID=-1
# Network card name that support EFVI, generally is Solarfare's
EFVINetworkCardName=cardname
# IP address of EFVI
EFVINetworkIP=127.0.0.1
# Port of EFVI, the user needs to ensure the port is available
EFVILocalPort=0
###########################################
####### Account configurations ########
###########################################
# Specify the session, valid range is 1-16, and 0 indicate not specify the session
# only one API instance is allowed to be online in one session. Support 16 sessions online at the same time.
# session 1-12 : Private flow is pushed according to the session id (private flow is isolated between sessions)
# session 13-16: Private flow is pushed according to the account (can receive all private flows from all sessions under the account)
BindSessionID=0
###########################################
####### Accelerate returns configs ########
###########################################
# whether to accelerate returns, 1 indicates accelerate returns
# this feature depends on the Nano server has enableed accelerated returns
AccelerateReturns=0
# whether to log for accelerate returns, should be turned off during trade
# 1 indictes turn on the log
LogForAccelerateReturns=0
###########################################
####### Misc configurations ########
###########################################
# Report regulatory infomation:0-Test; 1-Official
JKZXRealPublicKey=1
# Seat optimization:0-close; 1-open
OptimalSeats=0
[log]
###########################################
####### Log configurations ########
###########################################
# log level:0 debug; 1 info; 2 warn; 3 error
level=3
[!info]
除了Misc configurations和Log configurations之外,目前配置文件参数都有对应的NanoAPI接口函数,如果同时指定了配置参数并调用了对应接口函数,以接口函数的调用为准。
Network configurations
TCPBusyMode:0 - epoll模式网络监听,不会100%占用CPU;1 - 忙等模式,会100%占用CPU
TCPTradingCPUID:TCP收发线程绑定的CPU核心,-1表示不指定绑核
参数对应接口:
/// Description:设置额外参数,在Init接口前调用
/// bIsBusyMode: tcp连接模式。默认非忙等模式
/// nCpuID: tcp连接线程绑核编号。默认不指定CPU编号
virtual void SetParams(bool bIsBusyMode = false, int nCpuID = -1) = 0;
EFVINetworkCardName:指定EFVI发送的网卡名,通常是solarfare网卡
EFVINetworkIP:指定EFVI发送的IP地址
EFVILocalPort:指定EFVI发送的端口号
参数对应接口:
/// Description:设置EFVI连接参数用于后续EFVI裸协议报单,在Init接口前调用(后续只使用普通UDP裸协议时无需调用本接口)
/// pEthName: 网卡名(solafare万兆网卡)
/// pLocalIp: 本地IP
/// nLocalport: 本地端口,EFVI的起始端口(多线程裸协议报单时会占用多个端口,客户需保证传入端口没有被占用)
virtual int SetEFVIParams(const char* pEthName, const char* pLocalIp, uint16_t nLocalport) = 0;
Account configurations
BindSessionID:账户本次登录绑定的会话号,有效范围1~16,多个API实例不能同时指定相同的会话号。
指定会话1~12:只收到账户下指定会话号报单的回报私有流。
指定会话13~16:可以收到账户下所有的回报私有流。
参数对应接口:
/// Description: 绑定会话编码
virtual int BindSessionID(const uint8 nSessionID) = 0;
Accelerate returns configs
AccelerateReturns:回报加速开关。0 - 关闭;1 - 开启。
LogForAccelerateReturns:回报加速流日志开关,实盘建议关闭。0 - 关闭;1 - 开启。
参数对应接口:
/// Description:设置FPGA参数,在Init接口前调用
/// bFpgaReturn : FPGA回报加速开关。设置true表示开启FPGA回报加速
/// nStreamLogCpuID : FPGA流日志开关。默认不开启流日志
virtual void SetFPGAParams(bool bFpgaReturn, bool bStreamLog = false) = 0;
Misc configurations
JKZXRealPublicKey:看穿式监管配置。默认 1 - 开启生产版看穿式;0 - 开启测试版看穿式,用于接入测试环境验证。
OptimalSeats:暂不支持。
Log configurations
level:日志级别。0 - debug;1 - info;2 - warn;3 - error;默认error级别
