Code Monkey home page Code Monkey logo

futugg's Introduction

FutuGG

FutuGG是基于FutuOpenD网关实现的Golang的SDK包,项目中使用了原生了proto文件,注意不要更改生成的go文件,修改了import路径。

特别声明

因为futugg是跟金钱打交道的,可能你会用来做交易。如果在使用过程中触发了某个bug,导致金钱损失,一切后果请自行承担!!!

环境依赖

  • 安装Google的protobuf,protoc-gen-go工具
  • Golang1.9及最新版本

使用方式

package main

import (
    "fmt"
    "futugg"
    _ "futugg/handlers"
)

func main() {

    block := make(chan bool)
    cli := futugg.New("0.0.0.0", "11250", "")

    futugg.Cmd("send.GetGlobalState", cli)
    cli.KeepAlive()

    // recv
    go func() {
        fmt.Println("start recv data")
        cli.Recv()
    }()

    // futugg.Cmd("send.Qot_Sub", cli, "HK.01810", "Broker", true, true, "None", false)
    // futugg.Cmd("send.Qot_RegQotPush", cli, "US.BILI", "Basic", true, false)
    // futugg.Cmd("send.Qot_GetSubInfo", cli, true)
    // futugg.Cmd("recv.Qot_UpdateBasicQot", cli, "HK.01810")
    // futugg.Cmd("send.Qot_GetKL", cli, "None", "1Min", "HK.01810", int32(1))
    // futugg.Cmd("recv.Qot_UpdateKL", cli, "HK.01810")
    // futugg.Cmd("send.Qot_GetRT", cli, "HK.01810")
    // futugg.Cmd("recv.Qot_UpdateRT", cli, "HK.01810")
    // futugg.Cmd("send.Qot_GetTicker", cli, "HK.01810", int32(2))
    // futugg.Cmd("send.Qot_GetOrderBook", cli, "HK.01810", int32(2))
    // futugg.Cmd("send.Qot_GetBroker", cli, "HK.01810")
    // futugg.Cmd("send.Qot_RequestHistoryKL", cli, "None", "1Min", "HK.01810", "2019-01-09 16:00:00", "2019-01-09 16:05:00")
    // futugg.Cmd("send.Qot_GetTradeDate", cli, int32(1), "2019-01-08 16:00:00", "2019-01-09 16:00:00")
    // futugg.Cmd("send.Qot_GetStaticInfo", cli, int32(1), int32(3), "HK.01810")
    // futugg.Cmd("send.Qot_GetPlateSet", cli, int32(1), int32(0))
    futugg.Cmd("send.Qot_GetPlateSecurity", cli, "HK.01810")

    <-block
}

使用前,需要启动富途网关OpenD,具体操作详见futu-api-doc介绍

广告

如有需要,可以填写推荐人牛牛号:7189075,谢谢哟!

文档简介

ProtoId 名称 说明
1001 InitConnect 初始化连接
1002 GetGlobalState 获取全局状态
1003 Notify 系统通知推送
1004 KeepAlive 保活心跳
2001 Trd_GetAccList 获取业务账户列表
2005 Trd_UnlockTrade 解锁或锁定交易
2008 Trd_SubAccPush 订阅业务账户的交易推送数据
2101 Trd_GetFunds 获取账户资金
2102 Trd_GetPositionList 获取账户持仓
2111 Trd_GetMaxTrdQtys 获取最大交易数量
2201 Trd_GetOrderList 获取订单列表
2202 Trd_PlaceOrder 下单
2205 Trd_ModifyOrder 修改订单
2208 Trd_UpdateOrder 推送订单状态变动通知
2211 Trd_GetOrderFillList 获取成交列表
2218 Trd_UpdateOrderFill 推送成交通知
2221 Trd_GetHistoryOrderList 获取历史订单列表
2222 Trd_GetHistoryOrderFillList 获取历史成交列表
3001 Qot_Sub 订阅或者反订阅
3002 Qot_RegQotPush 注册推送
3003 Qot_GetSubInfo 获取订阅信息
3004 Qot_GetBasicQot 获取股票基本行情
3005 Qot_UpdateBasicQot 推送股票基本行情
3006 Qot_GetKL 获取K线
3007 Qot_UpdateKL 推送K线
3008 Qot_GetRT 获取分时
3009 Qot_UpdateRT 推送分时
3010 Qot_GetTicker 获取逐笔
3011 Qot_UpdateTicker 推送逐笔
3012 Qot_GetOrderBook 获取买卖盘
3013 Qot_UpdateOrderBook 推送买卖盘
3014 Qot_GetBroker 获取经纪队列
3015 Qot_UpdateBroker 推送经纪队列
3100 Qot_GetHistoryKL 从本地下载历史数据获取单只股票一段历史K线
3101 Qot_GetHistoryKLPoints 从本地下载历史数据获取多只股票多点历史K线
3102 Qot_GetRehab 从本地下载历史数据获取复权信息
3103 Qot_RequestHistoryKL 在线获取单只股票一段历史K线
3200 Qot_GetTradeDate 获取市场交易日
3202 Qot_GetStaticInfo 获取股票静态信息
3203 Qot_GetSecuritySnapshot 获取股票快照
3204 Qot_GetPlateSet 获取板块集合下的板块
3205 Qot_GetPlateSecurity 获取板块下的股票
3206 Qot_GetReference 获取正股相关股票
3207 Qot_GetOwnerPlate 获取股票所属板块
3208 Qot_GetHoldingChangeList 获取持股变化列表

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.