量化接口的代码都要怎么找呢?其实很多股票论坛上都有,或者是一些编程相关的网站也能找到,直接搜索量化接口代码就有了,什么编程语言都有,比较多的是Python,而且Python也比较容易上手,适合大部分小白。
这里我们也直接给一套Python的量化接口代码,有需要的小伙伴可以自取:
#-*-coding:utf-8-*-
import ctypes #引入ctypes调用dll的支持库
import json
import sys
from ctypes import c_char_p
from ctypes import c_int
from ctypes import c_int
dll = ctypes.WinDLL("qsapi.dll")#加载DLL
#以下为定义参数类型
dll.readid.argtypes = [c_char_p]
dll.signin.argtypes = [c_char_p,c_char_p,c_char_p]
dll.transaction.argtypes = [c_char_p,c_char_p,c_int,c_char_p,c_char_p,c_char_p]
dll.query.argtypes = [c_char_p,c_char_p,ctypes.c_int]
#以下为定义返回值类型
dll.readid.restype = ctypes.c_char_p
dll.signin.restype = ctypes.c_char_p
dll.transaction.restype = ctypes.c_char_p
dll.query.restype = ctypes.c_char_p
qsmc = ctypes.create_strin