{"id":17081940,"url":"https://github.com/yutiansut/qifi","last_synced_at":"2026-02-05T10:33:32.871Z","repository":{"id":105876420,"uuid":"212510186","full_name":"yutiansut/QIFI","owner":"yutiansut","description":"Quantaxis Differential Information Flow for Finance Intergration","archived":false,"fork":false,"pushed_at":"2020-10-23T07:22:10.000Z","size":91,"stargazers_count":14,"open_issues_count":0,"forks_count":20,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-08T23:02:19.885Z","etag":null,"topics":["quantaxis"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yutiansut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-03T06:22:18.000Z","updated_at":"2024-05-09T06:05:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5eae08a-2db9-4b28-b7e5-e7b774689076","html_url":"https://github.com/yutiansut/QIFI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yutiansut/QIFI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutiansut%2FQIFI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutiansut%2FQIFI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutiansut%2FQIFI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutiansut%2FQIFI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yutiansut","download_url":"https://codeload.github.com/yutiansut/QIFI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutiansut%2FQIFI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29119232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T09:40:36.738Z","status":"ssl_error","status_checked_at":"2026-02-05T09:36:49.977Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quantaxis"],"created_at":"2024-10-14T12:57:55.709Z","updated_at":"2026-02-05T10:33:32.856Z","avatar_url":"https://github.com/yutiansut.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# QIFI\nQuantaxis Differential Information Flow for Finance Intergration\n\n\nQIFI 协议 作为qatrader/ qapms的标准协议, 支持股票/期货市场\n\n\n- 源于快期的 DIFF协议 (Differential Information Flow for Finance)\n- 名称 QIFI   为 Quantaxis Differential Information Flow for Finance Intergration\n\n- 核心字段\n\t-  'accounts'\n\n\t-  'events'\n\n\t-  'trades'\n\n\t-  'orders'\n\n\t-  'positions'\n\n\t-  'broker_name'\n\t\t\n此协议是QUANTAXIS 未来1年以内的稳定版本, 不会更改\n\n此协议目前也是我们内部实盘在用, 兼容风控系统的一个协议, 稳定运行半年左右\n\n\n交易的协议参见[交易协议](trade_protocol.md)\n\n\n### 关联项目\n\n\n- [QUANTAXIS](https://github.com/quantaxis/quantaxis)\n- [QATrader](https://github.com/yutiansut/qatrader)\n- [QIFIAccount](https://github.com/yutiansut/QIFIAccount)\n- [QAStrategy](https://github.com/yutiansut/QAStrategy)\n- [qatrader-rs](https://github.com/yutiansut/qatrader-rs)\n\n\n- [QAPMS](https://github.com/yutiansut/QAPMS)\n- [QACEPEngine](https://github.com/yutiansut/QACEPEngine)\n- [QARiskPro](https://github.com/yutiansut/QARiskPro)\n- [QAPBSystem](https://github.com/yutiansut/QAPBSystem)\n\n\n\n\n\n\n###  为什么要有这个协议:\n\n主要目的是把 策略  /  背后的账户实现解耦\n\n策略无需关心背后的账户情况, 仅需相应的申请资源即可(如 申请模拟账户/ 申请回测账户/ 申请实盘账户/)\n策略在申请完毕后, 可以直接去读取相应字段,  如 策略想获取持仓的时候 即可直接get('positions') 即为持仓字段\n\n\n\n\n### 协议实例概览\n\n```json\n{\n    \"account_cookie\" : \"100010\",  // 账户号(兼容QUANTAXIS QAAccount)\n    \"password\" : \"100010\",\n    \"ping_gap\" : 5,\n    \"portfolio\" : \"default\",\n    \"broker_name\" : \"QUANTAXIS\",  // 接入商名称\n    \"capital_password\" : null,   // 资金密码 (实盘用)\n    \"bank_password\" : null,   // 银行密码(实盘用)\n    \"bankid\" : \"SIM\",         // 银行id\n    \"investor_name\" : \"\",   // 开户人名称\n    \"money\" : 0.0,          // 当前可用现金\n    \"pub_host\" : \"localhost\",\n    \"settlement\" : {},\n    \"taskid\" : null,\n    \"trade_host\" : \"127.0.0.1\",\n    \"updatetime\" : \"2019-09-06 21:19:48.346640\",\n    \"wsuri\" : \"ws://www.yutiansut.com:7988\",\n    \"bankname\" : \"模拟银行\",\n    \"trading_day\" : \"20190909\",\n    \"status\" : 200\n    \"eventmq_ip: \"192.168.2.126:5672\",\n    \"accounts\" : {\n        \"user_id\" : \"100010\",  // 用户号 兼容diff协议, ==\u003e 实盘则为具体账户号\n        \"currency\" : \"CNY\",    // 货币属性 兼容diff协议\n        \"pre_balance\" : 0.0,   // 上一个交易日的结算权益\n        \"deposit\" : 1000000.0, // 今日转入资金\n        \"withdraw\" : 0.0,      // 今日转出资金\n        \"WithdrawQuota\" : 3.95252516672997e-322, // 当前可取字段(QIFI 独有)\n        \"close_profit\" : 0.0,  // 平仓盈亏\n        \"commission\" : 6.84,   // 手续费\n        \"premium\" : 0.0,       // 附加费\n        \"static_balance\" : 1000000.0,   // 静态权益(一般= pre_balance)\n        \"position_profit\" : -80.0,  // 持仓盈亏\n        \"float_profit\" : -80.0,   // 浮动盈亏\n        \"balance\" : 999913.16,    // 当前权益\n        \"margin\" : 5472.0,        // 保证金\n        \"frozen_margin\" : 5472.0,  // 冻结保证金\n        \"frozen_commission\" : 0.0, // 冻结手续费\n        \"frozen_premium\" : 0.0,    // 冻结附加费用\n        \"available\" : 988969.16,   // 可用资金\n        \"risk_ratio\" : 0.00547247522974895   // 风险度\n    },\n    \"banks\" : {               // 银行内容(支持多银行 id识别)\n        \"SIM\" : {\n            \"id\" : \"SIM\",\n            \"name\" : \"模拟银行\",\n            \"bank_account\" : \"\",\n            \"fetch_amount\" : 0.0,\n            \"qry_count\" : 0\n        }\n    },\n    \"event\" : {                   // 事件 time+ 内容\n        \"2019-09-06 21:01:36\" : \"登录成功\",\n        \"2019-09-06 21:12:53\" : \"下单成功\",\n        \"2019-09-06 21:14:25\" : \"下单成功\",\n        \"2019-09-06 21:14:37\" : \"下单成功\",\n        \"2019-09-06 21:14:57\" : \"成交通知,合约:SHFE.rb2001,手数:1\",\n        \"2019-09-06 21:16:50\" : \"成交通知,合约:SHFE.rb2001,手数:1\"\n    },\n    \"orders\" : {            // 多段order 订单\n        \"QAOTG_5oAYRUI3\" : {\n            \"seqno\" : 8,\n            \"user_id\" : \"100010\",\n            \"order_id\" : \"QAOTG_5oAYRUI3\",\n            \"exchange_id\" : \"SHFE\",\n            \"instrument_id\" : \"rb2001\",\n            \"direction\" : \"SELL\",\n            \"offset\" : \"OPEN\",\n            \"volume_orign\" : 1,\n            \"price_type\" : \"LIMIT\",\n            \"limit_price\" : 3426.0,\n            \"time_condition\" : \"GFD\",\n            \"volume_condition\" : \"ANY\",\n            \"insert_date_time\" : NumberLong(1567775573528050636),\n            \"exchange_order_id\" : \"QAOTG_5oAYRUI3\",\n            \"status\" : \"FINISHED\",\n            \"volume_left\" : 0,\n            \"last_msg\" : \"\"\n        },\n        \"QAOTG_xyVXjgcZ\" : {\n            \"seqno\" : 3,\n            \"user_id\" : \"100010\",\n            \"order_id\" : \"QAOTG_xyVXjgcZ\",\n            \"exchange_id\" : \"SHFE\",\n            \"instrument_id\" : \"rb2001\",\n            \"direction\" : \"SELL\",\n            \"offset\" : \"OPEN\",\n            \"volume_orign\" : 1,\n            \"price_type\" : \"LIMIT\",\n            \"limit_price\" : 3480.0,\n            \"time_condition\" : \"GFD\",\n            \"volume_condition\" : \"ANY\",\n            \"insert_date_time\" : NumberLong(1567775665377198042),\n            \"exchange_order_id\" : \"QAOTG_xyVXjgcZ\",\n            \"status\" : \"ALIVE\",\n            \"volume_left\" : 1,\n            \"last_msg\" : \"\"\n        },\n    },\n    \"positions\" : {\n        \"SHFE_rb2001\" : {\n            \"user_id\" : \"100010\",\n            \"exchange_id\" : \"SHFE\",\n            \"instrument_id\" : \"rb2001\",\n            \"volume_long_today\" : 1,\n            \"volume_long_his\" : 0,\n            \"volume_long\" : 1,\n            \"volume_long_frozen_today\" : 0,\n            \"volume_long_frozen_his\" : 0,\n            \"volume_long_frozen\" : 0,\n            \"volume_short_today\" : 1,\n            \"volume_short_his\" : 0,\n            \"volume_short\" : 1,\n            \"volume_short_frozen_today\" : 0,\n            \"volume_short_frozen_his\" : 0,\n            \"volume_short_frozen\" : 0,\n            \"volume_long_yd\" : 0,\n            \"volume_short_yd\" : 0,\n            \"pos_long_his\" : 0,\n            \"pos_long_today\" : 1,\n            \"pos_short_his\" : 0,\n            \"pos_short_today\" : 1,\n            \"open_price_long\" : 3434.0,\n            \"open_price_short\" : 3426.0,\n            \"open_cost_long\" : 34340.0,\n            \"open_cost_short\" : 34260.0,\n            \"position_price_long\" : 3434.0,\n            \"position_price_short\" : 3426.0,\n            \"position_cost_long\" : 34340.0,\n            \"position_cost_short\" : 34260.0,\n            \"last_price\" : 3432.0,\n            \"float_profit_long\" : -20.0,\n            \"float_profit_short\" : -60.0,\n            \"float_profit\" : -80.0,\n            \"position_profit_long\" : -20.0,\n            \"position_profit_short\" : -60.0,\n            \"position_profit\" : -80.0,\n            \"margin_long\" : 2736.0,\n            \"margin_short\" : 2736.0,\n            \"margin\" : 5472.0\n        }\n    },\n    \"trades\" : {\n        \"6\" : {\n            \"seqno\" : 7,\n            \"user_id\" : \"100010\",\n            \"trade_id\" : \"6\",\n            \"exchange_id\" : \"SHFE\",\n            \"instrument_id\" : \"rb2001\",\n            \"order_id\" : \"QAOTG_5oAYRUI3\",\n            \"exchange_trade_id\" : \"6\",\n            \"direction\" : \"SELL\",\n            \"offset\" : \"OPEN\",\n            \"volume\" : 1,\n            \"price\" : 3426.0,\n            \"trade_date_time\" : NumberLong(1567775697237747424),\n            \"commission\" : 3.42\n        },\n        \"11\" : {\n            \"seqno\" : 12,\n            \"user_id\" : \"100010\",\n            \"trade_id\" : \"11\",\n            \"exchange_id\" : \"SHFE\",\n            \"instrument_id\" : \"rb2001\",\n            \"order_id\" : \"QAOTG_P4kEw2FJ\",\n            \"exchange_trade_id\" : \"11\",\n            \"direction\" : \"BUY\",\n            \"offset\" : \"OPEN\",\n            \"volume\" : 1,\n            \"price\" : 3434.0,\n            \"trade_date_time\" : NumberLong(1567775810195972480),\n            \"commission\" : 3.42\n        }\n    },\n    \"transfers\" : {},\n }\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyutiansut%2Fqifi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyutiansut%2Fqifi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyutiansut%2Fqifi/lists"}