聚宽量化是干什么的?

聚宽是一家量化交易平台,为投资者提供做量化交易的工具与服务,帮助投资者更好地做量化交易。也就是说,在聚宽量化交易平台,“大型收割机”已经为你准备好了,不需要你自己造了,你只需要学会使用它。

不过,当从量化交易的角度来看,我们其实没有必要紧盯了聚宽不放,因为国内还有很多量化交易平台或者量化交易接口的,例如下面这个量化交易接口,它一样可以提供程序化交易,也允许二次开发,而且交易频率高于普通的量化平台,我们来看看这个交易接口的c++语言登录代码:

// 加载DLL
HINSTANCE hDLL = LoadLibraryA("MetaTrade.dll");
assert(hDLL);

// 初始化
typedef int (*InitProc)();
const auto Init = reinterpret_cast<InitProc>(GetProcAddress(hDLL, "Init"));
assert(Init);
const int authorizedCount = Init(); // 已授权账号数量
assert(authorizedCount > 0);
std::cout << "已授权账号数量: " << authorizedCount << std::endl;
std::cout << std::endl;


// 接收缓冲区, 用于接收返回结果和错误信息
auto resultBuf = std::make_unique<char[]>(1024 * 1024);
auto errinfoBuf = std::make_unique<char[]>(256);
char *const result = resultBuf.get();
char *const errinfo = errinfoBuf.get();

// 登录 接口支持普通交易和两融交易账号, 以下例子使用两融账号
typedef int (*LogonProc)(const char *ip, short port, const char *version,
                         short yybid, const char *account,
                         const char *tradeAccount, const char *jyPassword,
                         const char *txPassword, char *errinfo);
const auto Logon = reinterpret_cast<LogonProc>(GetProcAddress(hDLL, "Logon"));
assert(Logon);
std::string ip = "1.2.3.4"; // 券商IP(注意区分两融和普通)
short port = 5678;          // 券商端口(注意区分两融和普通)
std::string version = "";   // 版本号: 一般填空
short yybid = 0;            // 营业部ID: 一般填0
std::string account = "12345678.C"; // 登录账号: 两融账号需添加.C结尾
std::string tradeAccount = "12345678"; // 交易账号: 一般与登录账号相同, 但不需添加.C结尾
std::string jyPassword = "password"; // 交易密码
std::string txPassword = ""; // 通讯密码: 一般填空
const int clientId = Logon(ip.c_str(), port, version.c_str(), yybid,
                           account.c_str(), tradeAccount.c_str(),
                           jyPassword.c_str(), txPassword.c_str(), errinfo);
assert(clientId >= 0);
std::cout << "登录成功, client = " << clientId << std::endl;
std::cout << std::endl;

后面还有一些查询、交易的代码,这里就不放出来了,我们可以直接拿到接口文件自己去看,小伙伴可以在gitee上下载,地址是:https://gitee.com/metatradeapi。其实现在量化操作已经是挺简便的了,将来可能会有越来越多人做量化也不一定。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值