Coder Social home page Coder Social logo

Comments (6)

titov-vv avatar titov-vv commented on August 29, 2024 1

For me it looks like IB reporting problem rather than ibflex issue. From what I see this '20200406;214347' value should be inside 'dateTime' field, not 'date'...

from ibflex.

csingley avatar csingley commented on August 29, 2024

Well, it's trying to convert a date/time into a date. Of course it's failing; the semicolon and everything after it isn't supposed to be there.

This means your data doesn't match the ibflex data model. What field is it, exactly, that has '20200406;214347' where my code is expecting a date type?

from ibflex.

kychanbp avatar kychanbp commented on August 29, 2024

I think it is in the TransactionTax.date part.

<TransactionTax accountId="XXXXXXXX acctAlias="" model="" currency="HKD" fxRateToBase="0.12899" assetCategory="STK" symbol="2801" description="ISHARES CORE MSCI CH IND ETF" conid="47028221" securityID="HK2801040828" securityIDType="ISIN" cusip="" isin="HK2801040828" listingExchange="SEHK" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" date="20200406;214347" taxDescription="SFC Transaction Levy" quantity="600" reportDate="20200407" taxAmount="-0.39771" tradeId="141292481" tradePrice="24.5500" source="TRADE" code="" levelOfDetail="SUMMARY" />
<TransactionTaxDetail accountId="XXXXXXXXX" acctAlias="" model="" currency="HKD" fxRateToBase="0.12899" assetCategory="STK" symbol="2801" description="ISHARES CORE MSCI CH IND ETF" conid="47028221" securityID="HK2801040828" securityIDType="ISIN" cusip="" isin="HK2801040828" listingExchange="SEHK" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" date="20200406;214347" taxDescription="SFC Transaction Levy" quantity="600" reportDate="20200407" taxAmount="-0.39771" tradeId="141292481" tradePrice="24.5500" source="TRADE" code="" levelOfDetail="DETAIL" />
</TransactionTaxes>

The problem happened after I brought some shares in HK stock exchange. There is no problem in US stocks.

I have looked at the data model. The date in TransactionTax Class is datetime.date. Not sure whether this is exchange specific.

from ibflex.

csingley avatar csingley commented on August 29, 2024

Do we have a reference for the TransactionTax element?

IB is not completely consistent in their reporting formats. ibflex.Types.StatementOfFundsLine.date is also of type datetime.datetime, despite the name.

IIRC, I allowed datetime.datetime converters to also accept a 'naked' date without time... see lines 215-220 in ibflex.parser.

Try changing the data type of ibflex.Types.TransactionTax.date from Optional[datetime.date] to Optional[datetime.datetime]. Does that solve your problem?

from ibflex.

kychanbp avatar kychanbp commented on August 29, 2024

Solved by changing datetime.date to datetime.datetime.

But I also need to add a new class TransactionTaxDetail which is the same as TransactionTax

from ibflex.

csingley avatar csingley commented on August 29, 2024

Please submit a PR once you've tested the changes. I don't have any data for TransactionTax etc. Thanks.

from ibflex.

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.