Giter Club home page Giter Club logo

Comments (30)

somewheve avatar somewheve commented on September 27, 2024

你打印下 app.recorder.positions 这个 看看里面有没有你的仓位

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

你的图片好像看不到? 我这边显示看不到

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

你在on_contract里面能打印下期权的头寸合约吗

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

判断下symbol或者local_symbol

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

能否提供一个simnow的带期权仓位的账户给我?

from ctpbee.

isomorphicor avatar isomorphicor commented on September 27, 2024

我这个是实盘 simnow还没有

from ctpbee.

isomorphicor avatar isomorphicor commented on September 27, 2024

我邮件给你实盘的

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

别 哥 实盘不至于吧

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

我晚上看看 稍等下 我今晚处理下 看看能不能搞定

from ctpbee.

isomorphicor avatar isomorphicor commented on September 27, 2024

感谢

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

@isomorphicor 我查了来这个仓位了 但是他和期货仓位一样 太诡异了

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

你的ctpbee版本是1.x? 你更新下试试

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

搞错了 没事了 我再研究研究

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

@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.

isomorphicor avatar isomorphicor commented on September 27, 2024

你的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.

isomorphicor avatar isomorphicor commented on September 27, 2024

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.

isomorphicor avatar isomorphicor commented on September 27, 2024

我发现问题了,是没有股指期货,只有商品期货

from ctpbee.

isomorphicor avatar isomorphicor commented on September 27, 2024

解决方法如下:
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.

isomorphicor avatar isomorphicor commented on September 27, 2024

但是仅有期权的account中balance还是不太对 @somewheve

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

on_bar函数触发参见ctpbee_kline.
只有一分钟的 暂时
然后你会提pr吗

这个balance是我从ctp那边查询回来的

from ctpbee.

isomorphicor avatar isomorphicor commented on September 27, 2024
  1. 包含期权的balance和不含权的不太一样,一个是市值,一个不包括期权价值,我理解有误哈
  2. 不过 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.

isomorphicor avatar isomorphicor commented on September 27, 2024
  1. 包含期权的balance和不含权的不太一样,一个是市值,一个不包括期权价值,我理解有误哈
  2. 不过 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.

somewheve avatar somewheve commented on September 27, 2024

要放在里面

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

那个Option的 我昨天推送到dev分支了 你记得往dev分支提交哈。

这个available药放在里面进行构造把

from ctpbee.

isomorphicor avatar isomorphicor commented on September 27, 2024

那个Option的 我昨天推送到dev分支了 你记得往dev分支提交哈。

这个available药放在里面进行构造把

1.5.7放外面
1.6.4放里面了,但是因为每隔1秒左右会刷新center中的account,那个时候会反复初始化,导致重新计算available
image

这样的话如果frozen等于0,avilable就会一直等于balance,而实际上不相等

所以我建议改成这样
image

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

理解了

你提交pr吗 还是我改

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

那我提交了 下个版本会修正

from ctpbee.

isomorphicor avatar isomorphicor commented on September 27, 2024

那我提交了 下个版本会修正

嗯嗯,村里断网了,刚看到

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

这个issue在新版本发布的时候会关掉哈

from ctpbee.

somewheve avatar somewheve commented on September 27, 2024

已经修正如何还有问题 到时候再打开

from ctpbee.

Related Issues (20)

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.