Comments (30)
你打印下 app.recorder.positions 这个 看看里面有没有你的仓位
from ctpbee.
你的图片好像看不到? 我这边显示看不到
from ctpbee.
你在on_contract里面能打印下期权的头寸合约吗
from ctpbee.
判断下symbol或者local_symbol
from ctpbee.
能否提供一个simnow的带期权仓位的账户给我?
from ctpbee.
我这个是实盘 simnow还没有
from ctpbee.
我邮件给你实盘的
from ctpbee.
别 哥 实盘不至于吧
from ctpbee.
我晚上看看 稍等下 我今晚处理下 看看能不能搞定
from ctpbee.
感谢
from ctpbee.
@isomorphicor 我查了来这个仓位了 但是他和期货仓位一样 太诡异了
from ctpbee.
你的ctpbee版本是1.x? 你更新下试试
from ctpbee.
搞错了 没事了 我再研究研究
from ctpbee.
@isomorphicor 我这边能查询到期权仓位哈 你更新ctpbee。 然后和客户经理沟通下 确认你们交易前置支持期权
PositionData( direction=Direction.LONG, exchange=DCE, float_pnl=-2060.0, frozen=0, local_position_id=i2405-P-900.DCE.Direction.LONG, local_symbol=i2405-P-900.DCE, open_price=20.6, pnl=0.0,
...
from ctpbee.
你的ctpbee版本是1.x? 你更新下试试
对1.5.7,我换成1.6.4之后对应的ctpbee_api也升级成了0.42,但发现on_bar函数触发有问题,然后用self.center.positions还是取不到哈。
1 . 是不是需要订阅?
2. 是不是需要用self.center.get_position(local_symbol) 指定具体合约代码才可以?
ps:换成1.6.4之后,self.center.account中的balance和avilable数值一样,也不太正常
from ctpbee.
constant 中的AccountData
是不是应该改成
class AccountData(Entity):
"""
Account data contains information about balance, frozen and
available.
"""
local_account_id: str = ""
accountid: str
balance: float = 0
frozen: float = 0
available: float = 0
def __post_init__(self):
""""""
# self.available = self.balance - self.frozen
self.local_account_id = f"{self.gateway_name}.{self.accountid}"
from ctpbee.
我发现问题了,是没有股指期货,只有商品期货
from ctpbee.
解决方法如下:
interface.ctp.lib.py
加1行
PRODUCT_CTP2VT = {
THOST_FTDC_PC_Futures: Product.FUTURES,
THOST_FTDC_PC_Options: Product.OPTION,
THOST_FTDC_PC_SpotOption: Product.OPTION
}
from ctpbee.
但是仅有期权的account中balance还是不太对 @somewheve
from ctpbee.
on_bar函数触发参见ctpbee_kline.
只有一分钟的 暂时
然后你会提pr吗
这个balance是我从ctp那边查询回来的
from ctpbee.
- 包含期权的balance和不含权的不太一样,一个是市值,一个不包括期权价值,我理解有误哈
- 不过 1.6.4相对于1.5.7问题在于 onRspQryTradingAccount函数account.available = data["Available"]没放在构造之外,导致轮询的时候available反复被重置为balance-frozen
account = AccountData(
accountid=data["AccountID"],
balance=data["Balance"],
frozen=data["FrozenMargin"] +
data["FrozenCash"] + data["FrozenCommission"],
gateway_name=self.gateway_name
)
account.available = data["Available"]
from ctpbee.
- 包含期权的balance和不含权的不太一样,一个是市值,一个不包括期权价值,我理解有误哈
- 不过 1.6.4相对于1.5.7问题在于 onRspQryTradingAccount函数account.available = data["Available"]没放在构造之外,导致轮询的时候available反复被重置为balance-frozen
account = AccountData( accountid=data["AccountID"], balance=data["Balance"], frozen=data["FrozenMargin"] + data["FrozenCash"] + data["FrozenCommission"], gateway_name=self.gateway_name ) account.available = data["Available"]
这两个都没问题的话,我提PR
from ctpbee.
要放在里面
from ctpbee.
那个Option的 我昨天推送到dev分支了 你记得往dev分支提交哈。
这个available药放在里面进行构造把
from ctpbee.
那个Option的 我昨天推送到dev分支了 你记得往dev分支提交哈。
这个available药放在里面进行构造把
1.5.7放外面
1.6.4放里面了,但是因为每隔1秒左右会刷新center中的account,那个时候会反复初始化,导致重新计算available
这样的话如果frozen等于0,avilable就会一直等于balance,而实际上不相等
from ctpbee.
理解了
你提交pr吗 还是我改
from ctpbee.
那我提交了 下个版本会修正
from ctpbee.
那我提交了 下个版本会修正
嗯嗯,村里断网了,刚看到
from ctpbee.
这个issue在新版本发布的时候会关掉哈
from ctpbee.
已经修正如何还有问题 到时候再打开
from ctpbee.
Related Issues (20)
- 运行快速开始里面的例子,出现如下提示DesignError:empty location for service name in line 18 of file ..\..\source\network\ServiceName.cpp HOT 1
- 交易所对信息量有限制,有没有自动计算信息量的函数?还有,在买入卖出发出后,当这笔订单没有到达交易所这段时间,它会出现在订单列表吗?如果没有,如何防止重复发单? HOT 4
- 对交易和行情在触发上的独立性的咨询 HOT 1
- buy和sell这些函数,是不是没有办法发送FAK订单? HOT 2
- 关于安装问题 HOT 2
- 执行 examples/send_order_demo.py 报错 HOT 2
- 请问生产环境ta2405.ZCE无法订阅到行情 HOT 1
- 请问现在是否支持获取历史数据 HOT 3
- 连接到simnow前置服务器时报错 locale::facet::_S_create_c_locale name not valid HOT 9
- 查询持仓总是返回none HOT 5
- 通过ctpbee下单后,如果通过期货公司客户端成功平仓后,ctpbee的self.center.get_position仍然可以查到平仓前的仓位 HOT 12
- 如何接入openctp蛤 HOT 1
- 'BeeTdApi' object has no attribute 'ReqQryTransferSerial' HOT 1
- 为什么使用作者的脚本登录成功后,行情/交易服务器状态总是False HOT 4
- 程序连续几次不断重启后,获取不到持仓信息
- 商品期货账户正常, 但是融航资管账户登录成功后, 程序退出 HOT 2
- 文档挂了 HOT 2
- pip install 之后,执行login.py,报找不到vnctpmd模块,这个怎么解决? HOT 31
- Ontick回调函数可以用,OnBar回调函数用不了,我写的例子就是作者自己写的demo,不知道咋回事啊 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctpbee.