agusalex / ghostfolio-sync

Sync Ghostfolio with IBKR
26 stars 8 forks source link

Failed creating #14

Open cellulosa opened 8 months ago

cellulosa commented 8 months ago

hi there, I'm trying get this to work with Ghostfolio 2.12.0. It seems like few things have changed? Also from the IBKR side?

here's what I get when I try and run the container:


[2023-10-18 16:55:36] Starting ghostfolio-sync Docker...
[2023-10-18 16:55:36] Crontab Not Present running one time now
Traceback (most recent call last):
  File "/usr/app/src/main.py", line 22, in <module>
    ghost.sync_ibkr()
  File "/usr/app/src/SyncIBKR.py", line 74, in sync_ibkr
    account_id = self.create_or_get_IBKR_accountId()
  File "/usr/app/src/SyncIBKR.py", line 253, in create_or_get_IBKR_accountId
    accounts = self.get_account()
  File "/usr/app/src/SyncIBKR.py", line 250, in get_account
    raise Exception(response)
Exception: <Response [502]>
[2023-10-18 16:55:37] Starting sync
[2023-10-18 16:55:37] Fetching Query
[2023-10-18 16:55:37] Parsing Query
[2023-10-18 16:55:39] Fetching Query
,"MIG":"Migranet","MIININGNFT": (bazillion characters in here so had to cut it) return this.prismaService.marketData.deleteMany(
[2023-10-18 16:55:39] Failed creating 
[2023-10-18 16:55:39] Failed to retrieve account ID closing now
[2023-10-18 16:55:39] End sync
gghostfolio-sync exited with code 0
agusalex commented 8 months ago

Hey, Exception: <Response [502]>502 is a bad gateway error. Did this issue persist? Maybe there's something wrong in IBKR side right now.

cellulosa commented 8 months ago

Heya, thanks for following up.

It seems to be something with the data structure? Now it says CashTransaction has no attribute 'figi'.

Could you post screenshots of what sections and options you have enabled for your Activity Flex Query on IBKR? I enabled only Cash Report and Cash transactions and selected all fields but left blank options:

Screenshot 2023-10-18 at 20 39 00

Screenshot 2023-10-18 at 20 39 50

ghostfolio-sync  | [2023-10-18 19:32:43] Starting ghostfolio-sync Docker...
ghostfolio-sync  | [2023-10-18 19:32:43] Crontab Not Present running one time now

ghostfolio-sync  | Traceback (most recent call last):
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 115, in parse_data_element
ghostfolio-sync  |     attrs = dict(
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 116, in <genexpr>
ghostfolio-sync  |     parse_element_attr(Class, k, v)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 156, in parse_element_attr
ghostfolio-sync  |     Type = Class.__annotations__[name]
ghostfolio-sync  | KeyError: 'figi'
ghostfolio-sync  | 
ghostfolio-sync  | During handling of the above exception, another exception occurred:
ghostfolio-sync  | 
ghostfolio-sync  | Traceback (most recent call last):
ghostfolio-sync  |   File "/usr/app/src/main.py", line 22, in <module>
ghostfolio-sync  |     ghost.sync_ibkr()
ghostfolio-sync  |   File "/usr/app/src/SyncIBKR.py", line 71, in sync_ibkr
ghostfolio-sync  |     query: FlexQueryResponse = parser.parse(response)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 53, in parse
ghostfolio-sync  |     parsed = parse_element(root)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 85, in parse_element
ghostfolio-sync  |     return parse_data_element(elem)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in parse_data_element
ghostfolio-sync  |     contained_elements = {child.tag: parse_element(child) for child in elem}
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in <dictcomp>
ghostfolio-sync  |     contained_elements = {child.tag: parse_element(child) for child in elem}
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 80, in parse_element
ghostfolio-sync  |     return parse_element_container(elem)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in parse_element_container
ghostfolio-sync  |     instances = tuple(parse_data_element(child) for child in elem)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in <genexpr>
ghostfolio-sync  |     instances = tuple(parse_data_element(child) for child in elem)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in parse_data_element
ghostfolio-sync  |     contained_elements = {child.tag: parse_element(child) for child in elem}
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in <dictcomp>
ghostfolio-sync  |     contained_elements = {child.tag: parse_element(child) for child in elem}
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 83, in parse_element
ghostfolio-sync  |     return parse_element_container(elem)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in parse_element_container
ghostfolio-sync  |     instances = tuple(parse_data_element(child) for child in elem)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in <genexpr>
ghostfolio-sync  |     instances = tuple(parse_data_element(child) for child in elem)
ghostfolio-sync  |   File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 121, in parse_data_element
ghostfolio-sync  |     raise FlexParserError(msg)
ghostfolio-sync  | ibflex.parser.FlexParserError: CashTransaction has no attribute 'figi'
ghostfolio-sync  | [2023-10-18 19:32:49] Starting sync
ghostfolio-sync  | [2023-10-18 19:32:49] Fetching Query
ghostfolio-sync  | [2023-10-18 19:32:49] Parsing Query
ghostfolio-sync exited with code 0
cellulosa commented 8 months ago

If I untick FIGI from Cash Transactions it throws:

unsupported operand type(s) for +=: 'decimal.Decimal' and 'NoneType'

Screenshot 2023-10-18 at 20 43 40

agusalex commented 8 months ago

I have these settings and everything is working for me:

agusalex commented 8 months ago

I updated some compatiblity stuff with ibflex lib, if you could try again with the latest docker image that would be great (do docker pull agusalex/ghostfolio-sync:latest Use the settings I provided above in your flex report.

cellulosa commented 8 months ago

Is there need to create a specific account (i.e. named IBKR or something) attached to a specific platform for it to work? I'm asking because I see this error being throw by Ghostfolio: An operation failed because it depends on one or more records that were required but not found. No 'Platform' record(s) (needed to inline the relation on 'Account' record(s)) was found for a nested connect on one-to-many relation 'AccountToPlatform'.

How about the options for both Cash Transactions, Cash Reports and Trades? By default, that's what I got:

Screenshot 2023-10-19 at 11 18 58 Screenshot 2023-10-19 at 11 19 03 Screenshot 2023-10-19 at 11 19 25

cellulosa commented 8 months ago

If I only enable Cash Report (no options, all fields on) I get:

Starting ghostfolio-sync Docker...
Crontab Not Present running one time now
Starting sync
Fetching Query
Parsing Query
unsupported operand type(s) for +=: 'decimal.Decimal' and 'NoneType'
Failed create: {"statusCode":500,"message":"Internal server error"}
Nothing new to sync
End sync

If I enable Cash Transactions only (all options on apart from summary, all fields on) I get:

Starting ghostfolio-sync Docker...
Crontab Not Present running one time now
Starting sync
Fetching Query
Parsing Query
tuple index out of range
tuple index out of range
No cash set, no cash retrieved
Nothing new to sync
End sync

If I enable Trades only (only execution option on, all fields on) I get:

Starting ghostfolio-sync Docker...
Crontab Not Present running one time now
Starting sync
Fetching Query
Parsing Query
tuple index out of range
tuple index out of range
No cash set, no cash retrieved
trade is not open or close (ignoring): %s Trade(transactionType=<TradeType.EXCHTRADE: 'ExchTrade'>, openCloseIndicator=None, buySell=<BuySell.SELL: 'SELL'>, orderType=<OrderType.LIMIT: 'LMT'>, assetCategory=<AssetClass.CASH: 'CASH'>, (...)
trade is not open or close (ignoring): %s Trade(transactionType=<TradeType.EXCHTRADE: 'ExchTrade'>, openCloseIndicator=None, buySell=<BuySell.SELL: 'SELL'>, orderType=None, assetCatego (...)
Nothing new to sync
End sync

Also when I pulled the :latest docker image it says:

The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 
agusalex commented 8 months ago

How are you running this? just python ? It seems your machine has ARM architecture and the image is built for x86 so docker won't work for your machine (unless you build it yourself). Regardless, the settings you tested now are the same settings I have.

It's hard to debug what's going wrong without trying it with your account since on mine this works just fine, and that, of course, is a privacy hazard. If you are okay with it regardless. just send me your IBQuery and Token via mail at agustin.c.alexander@gmail.com and I'll try to debug it. If you do, leave everything enabled: Cash Report, Cash Transactions, and Trades with the settings you mentioned.

Without it, I have no clue what might be going wrong.

agusalex commented 8 months ago

One more thing, do you have any trades/cash transactions made on your account already? if yes. What is the period for your FlexQuery? I have it set at 365 days (1 year) and I have transactions within that timeframe. Keep in mind that if your transactions or trades are previous to that you won't get anything back.

cellulosa commented 8 months ago

I'm running it with Docker via Colima on MacOS on a M2 machine.

This is a sample of a manually-generated .xml (omitting al numbers and ids):

<FlexQueryResponse queryName="ghostfolio" type="AF">
<FlexStatements count="1">
<FlexStatement accountId="xxx" fromDate="xxx" toDate="xxx" period="Last365CalendarDays" whenGenerated="xxx;xxx">
<CashReport>
<CashReportCurrency accountId="xxx" acctAlias="" model="" currency="BASE_SUMMARY" levelOfDetail="BaseCurrency" fromDate="xxx" toDate="xxx" startingCash="x.xxx" startingCashSec="x.xxx" startingCashCom="0" clientFees="0" clientFeesSec="0" clientFeesCom="0" clientFeesMTD="0" clientFeesYTD="0" commissions="-x.xxx" commissionsSec="-x.xxx" commissionsCom="0" commissionsMTD="0" commissionsYTD="-x.xxx" referralFee="0" referralFeeSec="0" referralFeeCom="0" referralFeeMTD="0" referralFeeYTD="0" commissionCreditsRedemption="0" commissionCreditsRedemptionSec="0" commissionCreditsRedemptionCom="0" commissionCreditsRedemptionMTD="0" commissionCreditsRedemptionYTD="0" billableCommissions="0" billableCommissionsSec="0" billableCommissionsCom="0" billableCommissionsMTD="0" billableCommissionsYTD="0" depositWithdrawals="x.xxx" depositWithdrawalsSec="x.xxx" depositWithdrawalsCom="0" depositWithdrawalsMTD="0" depositWithdrawalsYTD="89" deposits="x.xxx" depositsSec="x.xxx" depositsCom="0" depositsMTD="0" depositsYTD="17189" withdrawals="-xxx" withdrawalsSec="-xxx" withdrawalsCom="0" withdrawalsMTD="0" withdrawalsYTD="-xxx" carbonCredits="0" carbonCreditsSec="0" carbonCreditsCom="0" carbonCreditsMTD="0" carbonCreditsYTD="0" donations="0" donationsSec="0" donationsCom="0" donationsMTD="0" donationsYTD="0" accountTransfers="0" accountTransfersSec="0" accountTransfersCom="0" accountTransfersMTD="0" accountTransfersYTD="0" linkingAdjustments="0" linkingAdjustmentsSec="0" linkingAdjustmentsCom="0" internalTransfers="0" internalTransfersSec="0" internalTransfersCom="0" internalTransfersMTD="0" internalTransfersYTD="0" paxosTransfers="0" paxosTransfersSec="0" paxosTransfersCom="0" paxosTransfersMTD="0" paxosTransfersYTD="0" excessFundSweep="0" excessFundSweepSec="0" excessFundSweepCom="0" excessFundSweepMTD="0" excessFundSweepYTD="0" debitCardActivity="0" debitCardActivitySec="0" debitCardActivityCom="0" debitCardActivityMTD="0" debitCardActivityYTD="0" billPay="0" billPaySec="0" billPayCom="0" billPayMTD="0" billPayYTD="0" dividends="x.xxx" dividendsSec="x.xxx" dividendsCom="0" dividendsMTD="x.xxx" dividendsYTD="x.xxx" insuredDepositInterest="0" insuredDepositInterestSec="0" insuredDepositInterestCom="0" insuredDepositInterestMTD="0" insuredDepositInterestYTD="0" brokerInterest="x.xxx" brokerInterestSec="x.xxx" brokerInterestCom="0" brokerInterestMTD="x.xxx" brokerInterestYTD="x.xxx" brokerFees="0" brokerFeesSec="0" brokerFeesCom="0" brokerFeesMTD="0" brokerFeesYTD="0" bondInterest="0" bondInterestSec="0" bondInterestCom="0" bondInterestMTD="0" bondInterestYTD="0" cashSettlingMtm="0" cashSettlingMtmSec="0" cashSettlingMtmCom="0" cashSettlingMtmMTD="0" cashSettlingMtmYTD="0" realizedVm="0" realizedVmSec="0" realizedVmCom="0" realizedVmMTD="0" realizedVmYTD="0" realizedForexVm="0" realizedForexVmSec="0" realizedForexVmCom="0" realizedForexVmMTD="0" realizedForexVmYTD="0" cfdCharges="0" cfdChargesSec="0" cfdChargesCom="0" cfdChargesMTD="0" cfdChargesYTD="0" netTradesSales="x.xxx" netTradesSalesSec="x.xxx" netTradesSalesCom="0" netTradesSalesMTD="x.xxx" netTradesSalesYTD="x.xxx" netTradesPurchases="-x.xxx" netTradesPurchasesSec="-x.xxx" netTradesPurchasesCom="0" netTradesPurchasesMTD="-x.xxx" netTradesPurchasesYTD="-x.xxx" advisorFees="0" advisorFeesSec="0" advisorFeesCom="0" advisorFeesMTD="0" advisorFeesYTD="0" feesReceivables="0" feesReceivablesSec="0" feesReceivablesCom="0" feesReceivablesMTD="0" feesReceivablesYTD="0" paymentInLieu="0" paymentInLieuSec="0" paymentInLieuCom="0" paymentInLieuMTD="0" paymentInLieuYTD="0" transactionTax="0" transactionTaxSec="0" transactionTaxCom="0" transactionTaxMTD="0" transactionTaxYTD="0" taxReceivables="0" taxReceivablesSec="0" taxReceivablesCom="0" taxReceivablesMTD="0" taxReceivablesYTD="0" withholdingTax="-x.xxx" withholdingTaxSec="-x.xxx" withholdingTaxCom="0" withholdingTaxMTD="-x.xxx" withholdingTaxYTD="-x.xxx" withholding871m="0" withholding871mSec="0" withholding871mCom="0" withholding871mMTD="0" withholding871mYTD="0" withholdingCollectedTax="0" withholdingCollectedTaxSec="0" withholdingCollectedTaxCom="0" withholdingCollectedTaxMTD="0" withholdingCollectedTaxYTD="0" salesTax="0" salesTaxSec="0" salesTaxCom="0" salesTaxMTD="0" salesTaxYTD="0" billableSalesTax="0" billableSalesTaxSec="0" billableSalesTaxCom="0" billableSalesTaxMTD="0" billableSalesTaxYTD="0" ipoSubscription="0" ipoSubscriptionSec="0" ipoSubscriptionCom="0" ipoSubscriptionMTD="0" ipoSubscriptionYTD="0" fxTranslationGainLoss="-x.xxx" fxTranslationGainLossSec="-x.xxx" fxTranslationGainLossCom="0" otherFees="0" otherFeesSec="0" otherFeesCom="0" otherFeesMTD="0" otherFeesYTD="0" other="0" otherSec="0" otherCom="0" endingCash="x.xxx" endingCashSec="x.xxx" endingCashCom="0" endingSettledCash="x.xxx" endingSettledCashSec="x.xxx" endingSettledCashCom="0" slbStartingCashCollateral="0" slbStartingCashCollateralSec="0" slbStartingCashCollateralCom="0" slbNetSecuritiesLentActivity="0" slbNetSecuritiesLentActivitySec="0" slbNetSecuritiesLentActivityCom="0" slbEndingCashCollateral="0" slbEndingCashCollateralSec="0" slbEndingCashCollateralCom="0" slbNetCash="0" slbNetCashSec="0" slbNetCashCom="0" slbNetSettledCash="0" slbNetSettledCashSec="0" slbNetSettledCashCom="0" />
<CashReportCurrency accountId="xxx" acctAlias="" model="" currency="EUR" levelOfDetail="Currency" fromDate="xxx" toDate="xxx" startingCash="0" startingCashSec="0" startingCashCom="0" clientFees="0" clientFeesSec="0" clientFeesCom="0" clientFeesMTD="0" clientFeesYTD="0" commissions="0" commissionsSec="0" commissionsCom="0" commissionsMTD="0" commissionsYTD="0" referralFee="0" referralFeeSec="0" referralFeeCom="0" referralFeeMTD="0" referralFeeYTD="0" commissionCreditsRedemption="0" commissionCreditsRedemptionSec="0" commissionCreditsRedemptionCom="0" commissionCreditsRedemptionMTD="0" commissionCreditsRedemptionYTD="0" billableCommissions="0" billableCommissionsSec="0" billableCommissionsCom="0" billableCommissionsMTD="0" billableCommissionsYTD="0" depositWithdrawals="xxx" depositWithdrawalsSec="xxx" depositWithdrawalsCom="0" depositWithdrawalsMTD="0" depositWithdrawalsYTD="20000" deposits="xxx" depositsSec="xxx" depositsCom="0" depositsMTD="0" depositsYTD="20000" withdrawals="0" withdrawalsSec="0" withdrawalsCom="0" withdrawalsMTD="0" withdrawalsYTD="0" carbonCredits="0" carbonCreditsSec="0" carbonCreditsCom="0" carbonCreditsMTD="0" carbonCreditsYTD="0" donations="0" donationsSec="0" donationsCom="0" donationsMTD="0" donationsYTD="0" accountTransfers="0" accountTransfersSec="0" accountTransfersCom="0" accountTransfersMTD="0" accountTransfersYTD="0" linkingAdjustments="0" linkingAdjustmentsSec="0" linkingAdjustmentsCom="0" internalTransfers="0" internalTransfersSec="0" internalTransfersCom="0" internalTransfersMTD="0" internalTransfersYTD="0" paxosTransfers="0" paxosTransfersSec="0" paxosTransfersCom="0" paxosTransfersMTD="0" paxosTransfersYTD="0" excessFundSweep="0" excessFundSweepSec="0" excessFundSweepCom="0" excessFundSweepMTD="0" excessFundSweepYTD="0" debitCardActivity="0" debitCardActivitySec="0" debitCardActivityCom="0" debitCardActivityMTD="0" debitCardActivityYTD="0" billPay="0" billPaySec="0" billPayCom="0" billPayMTD="0" billPayYTD="0" dividends="0" dividendsSec="0" dividendsCom="0" dividendsMTD="0" dividendsYTD="0" insuredDepositInterest="0" insuredDepositInterestSec="0" insuredDepositInterestCom="0" insuredDepositInterestMTD="0" insuredDepositInterestYTD="0" brokerInterest="x.xxx" brokerInterestSec="x.xxx" brokerInterestCom="0" brokerInterestMTD="x.xxx" brokerInterestYTD="x.xxx" brokerFees="0" brokerFeesSec="0" brokerFeesCom="0" brokerFeesMTD="0" brokerFeesYTD="0" bondInterest="0" bondInterestSec="0" bondInterestCom="0" bondInterestMTD="0" bondInterestYTD="0" cashSettlingMtm="0" cashSettlingMtmSec="0" cashSettlingMtmCom="0" cashSettlingMtmMTD="0" cashSettlingMtmYTD="0" realizedVm="0" realizedVmSec="0" realizedVmCom="0" realizedVmMTD="0" realizedVmYTD="0" realizedForexVm="0" realizedForexVmSec="0" realizedForexVmCom="0" realizedForexVmMTD="0" realizedForexVmYTD="0" cfdCharges="0" cfdChargesSec="0" cfdChargesCom="0" cfdChargesMTD="0" cfdChargesYTD="0" netTradesSales="0" netTradesSalesSec="0" netTradesSalesCom="0" netTradesSalesMTD="0" netTradesSalesYTD="0" netTradesPurchases="-x.xxx" netTradesPurchasesSec="-x.xxx" netTradesPurchasesCom="0" netTradesPurchasesMTD="-x.xxx" netTradesPurchasesYTD="-x.xxx" advisorFees="0" advisorFeesSec="0" advisorFeesCom="0" advisorFeesMTD="0" advisorFeesYTD="0" feesReceivables="0" feesReceivablesSec="0" feesReceivablesCom="0" feesReceivablesMTD="0" feesReceivablesYTD="0" paymentInLieu="0" paymentInLieuSec="0" paymentInLieuCom="0" paymentInLieuMTD="0" paymentInLieuYTD="0" transactionTax="0" transactionTaxSec="0" transactionTaxCom="0" transactionTaxMTD="0" transactionTaxYTD="0" taxReceivables="0" taxReceivablesSec="0" taxReceivablesCom="0" taxReceivablesMTD="0" taxReceivablesYTD="0" withholdingTax="0" withholdingTaxSec="0" withholdingTaxCom="0" withholdingTaxMTD="0" withholdingTaxYTD="0" withholding871m="0" withholding871mSec="0" withholding871mCom="0" withholding871mMTD="0" withholding871mYTD="0" withholdingCollectedTax="0" withholdingCollectedTaxSec="0" withholdingCollectedTaxCom="0" withholdingCollectedTaxMTD="0" withholdingCollectedTaxYTD="0" salesTax="0" salesTaxSec="0" salesTaxCom="0" salesTaxMTD="0" salesTaxYTD="0" billableSalesTax="0" billableSalesTaxSec="0" billableSalesTaxCom="0" billableSalesTaxMTD="0" billableSalesTaxYTD="0" ipoSubscription="0" ipoSubscriptionSec="0" ipoSubscriptionCom="0" ipoSubscriptionMTD="0" ipoSubscriptionYTD="0" fxTranslationGainLoss="0" fxTranslationGainLossSec="0" fxTranslationGainLossCom="0" otherFees="0" otherFeesSec="0" otherFeesCom="0" otherFeesMTD="0" otherFeesYTD="0" other="0" otherSec="0" otherCom="0" endingCash="0" endingCashSec="0" endingCashCom="0" endingSettledCash="0" endingSettledCashSec="0" endingSettledCashCom="0" slbStartingCashCollateral="0" slbStartingCashCollateralSec="0" slbStartingCashCollateralCom="0" slbNetSecuritiesLentActivity="0" slbNetSecuritiesLentActivitySec="0" slbNetSecuritiesLentActivityCom="0" slbEndingCashCollateral="0" slbEndingCashCollateralSec="0" slbEndingCashCollateralCom="0" slbNetCash="0" slbNetCashSec="0" slbNetCashCom="0" slbNetSettledCash="0" slbNetSettledCashSec="0" slbNetSettledCashCom="0" />
<CashReportCurrency accountId="xxx" acctAlias="" model="" currency="GBP" levelOfDetail="Currency" fromDate="xxx" toDate="xxx" startingCash="x.xxx" startingCashSec="x.xxx" startingCashCom="0" clientFees="0" clientFeesSec="0" clientFeesCom="0" clientFeesMTD="0" clientFeesYTD="0" commissions="-x.xxx" commissionsSec="-x.xxx" commissionsCom="0" commissionsMTD="0" commissionsYTD="-x.xxx" referralFee="0" referralFeeSec="0" referralFeeCom="0" referralFeeMTD="0" referralFeeYTD="0" commissionCreditsRedemption="0" commissionCreditsRedemptionSec="0" commissionCreditsRedemptionCom="0" commissionCreditsRedemptionMTD="0" commissionCreditsRedemptionYTD="0" billableCommissions="0" billableCommissionsSec="0" billableCommissionsCom="0" billableCommissionsMTD="0" billableCommissionsYTD="0" depositWithdrawals="-xxx" depositWithdrawalsSec="-xxx" depositWithdrawalsCom="0" depositWithdrawalsMTD="0" depositWithdrawalsYTD="-xxx" deposits="0" depositsSec="0" depositsCom="0" depositsMTD="0" depositsYTD="0" withdrawals="-xxx" withdrawalsSec="-xxx" withdrawalsCom="0" withdrawalsMTD="0" withdrawalsYTD="-xxx" carbonCredits="0" carbonCreditsSec="0" carbonCreditsCom="0" carbonCreditsMTD="0" carbonCreditsYTD="0" donations="0" donationsSec="0" donationsCom="0" donationsMTD="0" donationsYTD="0" accountTransfers="0" accountTransfersSec="0" accountTransfersCom="0" accountTransfersMTD="0" accountTransfersYTD="0" linkingAdjustments="0" linkingAdjustmentsSec="0" linkingAdjustmentsCom="0" internalTransfers="0" internalTransfersSec="0" internalTransfersCom="0" internalTransfersMTD="0" internalTransfersYTD="0" paxosTransfers="0" paxosTransfersSec="0" paxosTransfersCom="0" paxosTransfersMTD="0" paxosTransfersYTD="0" excessFundSweep="0" excessFundSweepSec="0" excessFundSweepCom="0" excessFundSweepMTD="0" excessFundSweepYTD="0" debitCardActivity="0" debitCardActivitySec="0" debitCardActivityCom="0" debitCardActivityMTD="0" debitCardActivityYTD="0" billPay="0" billPaySec="0" billPayCom="0" billPayMTD="0" billPayYTD="0" dividends="0" dividendsSec="0" dividendsCom="0" dividendsMTD="0" dividendsYTD="0" insuredDepositInterest="0" insuredDepositInterestSec="0" insuredDepositInterestCom="0" insuredDepositInterestMTD="0" insuredDepositInterestYTD="0" brokerInterest="0" brokerInterestSec="0" brokerInterestCom="0" brokerInterestMTD="0" brokerInterestYTD="0" brokerFees="0" brokerFeesSec="0" brokerFeesCom="0" brokerFeesMTD="0" brokerFeesYTD="0" bondInterest="0" bondInterestSec="0" bondInterestCom="0" bondInterestMTD="0" bondInterestYTD="0" cashSettlingMtm="0" cashSettlingMtmSec="0" cashSettlingMtmCom="0" cashSettlingMtmMTD="0" cashSettlingMtmYTD="0" realizedVm="0" realizedVmSec="0" realizedVmCom="0" realizedVmMTD="0" realizedVmYTD="0" realizedForexVm="0" realizedForexVmSec="0" realizedForexVmCom="0" realizedForexVmMTD="0" realizedForexVmYTD="0" cfdCharges="0" cfdChargesSec="0" cfdChargesCom="0" cfdChargesMTD="0" cfdChargesYTD="0" netTradesSales="x.xxx" netTradesSalesSec="x.xxx" netTradesSalesCom="0" netTradesSalesMTD="x.xxx" netTradesSalesYTD="x.xxx" netTradesPurchases="0" netTradesPurchasesSec="0" netTradesPurchasesCom="0" netTradesPurchasesMTD="0" netTradesPurchasesYTD="0" advisorFees="0" advisorFeesSec="0" advisorFeesCom="0" advisorFeesMTD="0" advisorFeesYTD="0" feesReceivables="0" feesReceivablesSec="0" feesReceivablesCom="0" feesReceivablesMTD="0" feesReceivablesYTD="0" paymentInLieu="0" paymentInLieuSec="0" paymentInLieuCom="0" paymentInLieuMTD="0" paymentInLieuYTD="0" transactionTax="0" transactionTaxSec="0" transactionTaxCom="0" transactionTaxMTD="0" transactionTaxYTD="0" taxReceivables="0" taxReceivablesSec="0" taxReceivablesCom="0" taxReceivablesMTD="0" taxReceivablesYTD="0" withholdingTax="0" withholdingTaxSec="0" withholdingTaxCom="0" withholdingTaxMTD="0" withholdingTaxYTD="0" withholding871m="0" withholding871mSec="0" withholding871mCom="0" withholding871mMTD="0" withholding871mYTD="0" withholdingCollectedTax="0" withholdingCollectedTaxSec="0" withholdingCollectedTaxCom="0" withholdingCollectedTaxMTD="0" withholdingCollectedTaxYTD="0" salesTax="0" salesTaxSec="0" salesTaxCom="0" salesTaxMTD="0" salesTaxYTD="0" billableSalesTax="0" billableSalesTaxSec="0" billableSalesTaxCom="0" billableSalesTaxMTD="0" billableSalesTaxYTD="0" ipoSubscription="0" ipoSubscriptionSec="0" ipoSubscriptionCom="0" ipoSubscriptionMTD="0" ipoSubscriptionYTD="0" fxTranslationGainLoss="0" fxTranslationGainLossSec="0" fxTranslationGainLossCom="0" otherFees="0" otherFeesSec="0" otherFeesCom="0" otherFeesMTD="0" otherFeesYTD="0" other="0" otherSec="0" otherCom="0" endingCash="x.xxx" endingCashSec="x.xxx" endingCashCom="0" endingSettledCash="x.xxx" endingSettledCashSec="x.xxx" endingSettledCashCom="0" slbStartingCashCollateral="0" slbStartingCashCollateralSec="0" slbStartingCashCollateralCom="0" slbNetSecuritiesLentActivity="0" slbNetSecuritiesLentActivitySec="0" slbNetSecuritiesLentActivityCom="0" slbEndingCashCollateral="0" slbEndingCashCollateralSec="0" slbEndingCashCollateralCom="0" slbNetCash="0" slbNetCashSec="0" slbNetCashCom="0" slbNetSettledCash="0" slbNetSettledCashSec="0" slbNetSettledCashCom="0" />
<CashReportCurrency accountId="xxx" acctAlias="" model="" currency="USD" levelOfDetail="Currency" fromDate="xxx" toDate="xxx" startingCash="x.xxx" startingCashSec="x.xxx" startingCashCom="0" clientFees="0" clientFeesSec="0" clientFeesCom="0" clientFeesMTD="0" clientFeesYTD="0" commissions="0" commissionsSec="0" commissionsCom="0" commissionsMTD="0" commissionsYTD="0" referralFee="0" referralFeeSec="0" referralFeeCom="0" referralFeeMTD="0" referralFeeYTD="0" commissionCreditsRedemption="0" commissionCreditsRedemptionSec="0" commissionCreditsRedemptionCom="0" commissionCreditsRedemptionMTD="0" commissionCreditsRedemptionYTD="0" billableCommissions="0" billableCommissionsSec="0" billableCommissionsCom="0" billableCommissionsMTD="0" billableCommissionsYTD="0" depositWithdrawals="0" depositWithdrawalsSec="0" depositWithdrawalsCom="0" depositWithdrawalsMTD="0" depositWithdrawalsYTD="0" deposits="0" depositsSec="0" depositsCom="0" depositsMTD="0" depositsYTD="0" withdrawals="0" withdrawalsSec="0" withdrawalsCom="0" withdrawalsMTD="0" withdrawalsYTD="0" carbonCredits="0" carbonCreditsSec="0" carbonCreditsCom="0" carbonCreditsMTD="0" carbonCreditsYTD="0" donations="0" donationsSec="0" donationsCom="0" donationsMTD="0" donationsYTD="0" accountTransfers="0" accountTransfersSec="0" accountTransfersCom="0" accountTransfersMTD="0" accountTransfersYTD="0" linkingAdjustments="0" linkingAdjustmentsSec="0" linkingAdjustmentsCom="0" internalTransfers="0" internalTransfersSec="0" internalTransfersCom="0" internalTransfersMTD="0" internalTransfersYTD="0" paxosTransfers="0" paxosTransfersSec="0" paxosTransfersCom="0" paxosTransfersMTD="0" paxosTransfersYTD="0" excessFundSweep="0" excessFundSweepSec="0" excessFundSweepCom="0" excessFundSweepMTD="0" excessFundSweepYTD="0" debitCardActivity="0" debitCardActivitySec="0" debitCardActivityCom="0" debitCardActivityMTD="0" debitCardActivityYTD="0" billPay="0" billPaySec="0" billPayCom="0" billPayMTD="0" billPayYTD="0" dividends="x.xxx" dividendsSec="x.xxx" dividendsCom="0" dividendsMTD="x.xxx" dividendsYTD="x.xxx" insuredDepositInterest="0" insuredDepositInterestSec="0" insuredDepositInterestCom="0" insuredDepositInterestMTD="0" insuredDepositInterestYTD="0" brokerInterest="0" brokerInterestSec="0" brokerInterestCom="0" brokerInterestMTD="0" brokerInterestYTD="0" brokerFees="0" brokerFeesSec="0" brokerFeesCom="0" brokerFeesMTD="0" brokerFeesYTD="0" bondInterest="0" bondInterestSec="0" bondInterestCom="0" bondInterestMTD="0" bondInterestYTD="0" cashSettlingMtm="0" cashSettlingMtmSec="0" cashSettlingMtmCom="0" cashSettlingMtmMTD="0" cashSettlingMtmYTD="0" realizedVm="0" realizedVmSec="0" realizedVmCom="0" realizedVmMTD="0" realizedVmYTD="0" realizedForexVm="0" realizedForexVmSec="0" realizedForexVmCom="0" realizedForexVmMTD="0" realizedForexVmYTD="0" cfdCharges="0" cfdChargesSec="0" cfdChargesCom="0" cfdChargesMTD="0" cfdChargesYTD="0" netTradesSales="0" netTradesSalesSec="0" netTradesSalesCom="0" netTradesSalesMTD="0" netTradesSalesYTD="0" netTradesPurchases="0" netTradesPurchasesSec="0" netTradesPurchasesCom="0" netTradesPurchasesMTD="0" netTradesPurchasesYTD="0" advisorFees="0" advisorFeesSec="0" advisorFeesCom="0" advisorFeesMTD="0" advisorFeesYTD="0" feesReceivables="0" feesReceivablesSec="0" feesReceivablesCom="0" feesReceivablesMTD="0" feesReceivablesYTD="0" paymentInLieu="0" paymentInLieuSec="0" paymentInLieuCom="0" paymentInLieuMTD="0" paymentInLieuYTD="0" transactionTax="0" transactionTaxSec="0" transactionTaxCom="0" transactionTaxMTD="0" transactionTaxYTD="0" taxReceivables="0" taxReceivablesSec="0" taxReceivablesCom="0" taxReceivablesMTD="0" taxReceivablesYTD="0" withholdingTax="-x.xxx" withholdingTaxSec="-x.xxx" withholdingTaxCom="0" withholdingTaxMTD="-x.xxx" withholdingTaxYTD="-x.xxx" withholding871m="0" withholding871mSec="0" withholding871mCom="0" withholding871mMTD="0" withholding871mYTD="0" withholdingCollectedTax="0" withholdingCollectedTaxSec="0" withholdingCollectedTaxCom="0" withholdingCollectedTaxMTD="0" withholdingCollectedTaxYTD="0" salesTax="0" salesTaxSec="0" salesTaxCom="0" salesTaxMTD="0" salesTaxYTD="0" billableSalesTax="0" billableSalesTaxSec="0" billableSalesTaxCom="0" billableSalesTaxMTD="0" billableSalesTaxYTD="0" ipoSubscription="0" ipoSubscriptionSec="0" ipoSubscriptionCom="0" ipoSubscriptionMTD="0" ipoSubscriptionYTD="0" fxTranslationGainLoss="0" fxTranslationGainLossSec="0" fxTranslationGainLossCom="0" otherFees="0" otherFeesSec="0" otherFeesCom="0" otherFeesMTD="0" otherFeesYTD="0" other="0" otherSec="0" otherCom="0" endingCash="x.xxx" endingCashSec="x.xxx" endingCashCom="0" endingSettledCash="x.xxx" endingSettledCashSec="x.xxx" endingSettledCashCom="0" slbStartingCashCollateral="0" slbStartingCashCollateralSec="0" slbStartingCashCollateralCom="0" slbNetSecuritiesLentActivity="0" slbNetSecuritiesLentActivitySec="0" slbNetSecuritiesLentActivityCom="0" slbEndingCashCollateral="0" slbEndingCashCollateralSec="0" slbEndingCashCollateralCom="0" slbNetCash="0" slbNetCashSec="0" slbNetCashCom="0" slbNetSettledCash="0" slbNetSettledCashSec="0" slbNetSettledCashCom="0" />
</CashReport>
<Trades>
<Trade accountId="xxx" acctAlias="" model="" currency="GBP" fxRateToBase="1" assetCategory="CASH" subCategory="" symbol="EUR.GBP" description="EUR.GBP" conid="xxx" securityID="" securityIDType="" cusip="" isin="" figi="" listingExchange="" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" tradeID="xxx" strike="" relatedTradeID="" expiry="" reportDate="xxxxxx" putCall="" dateTime="xxxxxx.xxxx" principalAdjustFactor="" tradeDate="xxx" settleDateTarget="xxx" transactionType="ExchTrade" exchange="IDEALFX" quantity="-xxx" tradePrice="x.xxx" tradeMoney="-x.xxx" proceeds="x.xxx" taxes="0" ibCommission="-x.xxx" ibCommissionCurrency="GBP" netCash="0" closePrice="0" openCloseIndicator="" notes="" cost="0" fifoPnlRealized="0" mtmPnl="x.xxx" origTradePrice="0" origTradeDate="" origTradeID="" origOrderID="0" origTransactionID="0" buySell="SELL" clearingFirmID="" ibOrderID="xxxxxxxxxx" transactionID="xxxxxxxxxx" ibExecID="xxx.xxx.xxx" relatedTransactionID="" brokerageOrderID="xxx.xxx.xxx" orderReference="" volatilityOrderLink="" exchOrderId="N/A" extExecID="xxx" orderTime="xxxxxx;xxxxx" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="LMT" traderID="" isAPIOrder="N" accruedInt="0" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 ()" />
<Trade accountId="xxx" acctAlias="" model="" currency="GBP" fxRateToBase="1" assetCategory="CASH" subCategory="" symbol="EUR.GBP" description="EUR.GBP" conid="xxx" securityID="" securityIDType="" cusip="" isin="" figi="" listingExchange="" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" tradeID="xxx" strike="" relatedTradeID="" expiry="" reportDate="xxxxxx" putCall="" dateTime="xxxxxx.xxxx" principalAdjustFactor="" tradeDate="xxx" settleDateTarget="xxx" transactionType="ExchTrade" exchange="IDEALFX" quantity="-xxx" tradePrice="x.xxx" tradeMoney="-x.xxx" proceeds="x.xxx" taxes="0" ibCommission="-x.xxx" ibCommissionCurrency="GBP" netCash="0" closePrice="0" openCloseIndicator="" notes="" cost="0" fifoPnlRealized="0" mtmPnl="-x.xxx" origTradePrice="0" origTradeDate="" origTradeID="" origOrderID="0" origTransactionID="0" buySell="SELL" clearingFirmID="" ibOrderID="xxxxxxxxxx" transactionID="xxxxxxxxxx" ibExecID="xxx.xxx.xxx" relatedTransactionID="" brokerageOrderID="xxx.xxx.xxx" orderReference="" volatilityOrderLink="" exchOrderId="N/A" extExecID="xxx" orderTime="xxxxxx;xxxxx" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="MKT" traderID="" isAPIOrder="N" accruedInt="0" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 ()" />
<Trade accountId="xxx" acctAlias="" model="" currency="GBP" fxRateToBase="1" assetCategory="CASH" subCategory="" symbol="EUR.GBP" description="EUR.GBP" conid="xxx" securityID="" securityIDType="" cusip="" isin="" figi="" listingExchange="" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" tradeID="xxx" strike="" relatedTradeID="" expiry="" reportDate="xxxxxx" putCall="" dateTime="xxxxxx.xxxx" principalAdjustFactor="" tradeDate="xxx" settleDateTarget="xxx" transactionType="ExchTrade" exchange="IDEALFX" quantity="-x.xxx" tradePrice="x.xxx" tradeMoney="-x.xxx" proceeds="x.xxx" taxes="0" ibCommission="0" ibCommissionCurrency="GBP" netCash="0" closePrice="0" openCloseIndicator="" notes="" cost="0" fifoPnlRealized="0" mtmPnl="x.xxx" origTradePrice="0" origTradeDate="" origTradeID="" origOrderID="0" origTransactionID="0" buySell="SELL" clearingFirmID="" ibOrderID="xxxxxxxxxx" transactionID="xxxxxxxxxx" ibExecID="xxx.xxx.xxx" relatedTransactionID="" brokerageOrderID="xxx.xxx.xxx" orderReference="" volatilityOrderLink="" exchOrderId="N/A" extExecID="xxx" orderTime="xxxxxx;xxxxx" openDateTime="" holdingPeriodDateTime="" whenRealized="" whenReopened="" levelOfDetail="EXECUTION" changeInPrice="0" changeInQuantity="0" orderType="" traderID="" isAPIOrder="N" accruedInt="0" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 ()" />
</Trades><CashTransactions>
<CashTransaction accountId="xxx" acctAlias="" model="" currency="USD" fxRateToBase="x.xxx" assetCategory="STK" subCategory="COMMON" symbol="xxx" description="xxx(xxx) CASH DIVIDEND USD 0.05 PER SHARE - US TAX" conid="xxx" securityID="xxx" securityIDType="ISIN" cusip="xxx" isin="xxx" figi="xxx" listingExchange="xxx" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="xxxxxx.xxxx" settleDate="xxxxxx" amount="-x.xxx" type="Withholding Tax" tradeID="" code="" transactionID="xxxxxxxxxx" reportDate="xxxxxx" clientReference="" actionID="xxxxxx" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 ()" />
<CashTransaction accountId="xxx" acctAlias="" model="" currency="USD" fxRateToBase="x.xxx" assetCategory="STK" subCategory="COMMON" symbol="xxx" description="xxx(xxx) CASH DIVIDEND USD 0.05 PER SHARE (Ordinary Dividend)" conid="xxx" securityID="xxx" securityIDType="xxx" cusip="xxx" isin="xxx" figi="xxx" listingExchange="xxx" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="xxxxxx.xxxx" settleDate="xxxxxx" amount="x.xxx" type="Dividends" tradeID="" code="" transactionID="xxxxxxxxxx" reportDate="xxxxxx" clientReference="" actionID="xxxxxx" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 ()" />
<CashTransaction accountId="xxx" acctAlias="" model="" currency="EUR" fxRateToBase="x.xxx" assetCategory="" subCategory="" symbol="" description="CASH RECEIPTS / ELECTRONIC FUND TRANSFERS" conid="" securityID="" securityIDType="" cusip="" isin="" figi="" listingExchange="" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="0" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="xxxxxx.xxxx" settleDate="xxxxxx" amount="xxx" type="Deposits/Withdrawals" tradeID="" code="" transactionID="xxxxxxxxxx" reportDate="xxxxxx" clientReference="" actionID="xxxxxx" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 (null)" />
<CashTransaction accountId="xxx" acctAlias="" model="" currency="GBP" fxRateToBase="1" assetCategory="" subCategory="" symbol="" description="DISBURSEMENT INITIATED BY Name Surname" conid="" securityID="" securityIDType="" cusip="" isin="" figi="" listingExchange="" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="0" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="xxxxxx.xxxx" settleDate="xxxxxx" amount="-xxx" type="Deposits/Withdrawals" tradeID="" code="" transactionID="xxxxxxxxxx" reportDate="xxxxxx" clientReference="" actionID="xxxxxx" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 (null)" />
<CashTransaction accountId="xxx" acctAlias="" model="" currency="GBP" fxRateToBase="1" assetCategory="" subCategory="" symbol="" description="DISBURSEMENT INITIATED BY Name Surname" conid="" securityID="" securityIDType="" cusip="" isin="" figi="" listingExchange="" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="0" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="xxxxxx.xxxx" settleDate="xxxxxx" amount="-xxx" type="Deposits/Withdrawals" tradeID="" code="" transactionID="xxxxxxxxxx" reportDate="xxxxxx" clientReference="" actionID="xxxxxx" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 (null)" />
<CashTransaction accountId="xxx" acctAlias="" model="" currency="EUR" fxRateToBase="x.xxx" assetCategory="" subCategory="" symbol="" description="EUR CREDIT INT FOR SEP-2023" conid="" securityID="" securityIDType="" cusip="" isin="" figi="" listingExchange="" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="0" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="xxxxxx.xxxx" settleDate="xxxxxx" amount="x.xxx" type="Broker Interest Received" tradeID="" code="" transactionID="xxxxxxxxxx" reportDate="xxxxxx" clientReference="" actionID="xxxxxx" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="x.xxx" weight="0.0 (null)" />
</CashTransactions>
</FlexStatement>
</FlexStatements>
</FlexQueryResponse>
denispol commented 8 months ago

Could it not be related to hardcoded platformId, in case of using a selfhosted instance of Ghostfolio? Platform should be created if it does not exist before the account creation occurs

def create_ibkr_account(self):
        account = {
            "accountType": "SECURITIES",
            "balance": 0,
            "currency": self.ghost_currency,
            "isExcluded": False,
            "name": "IBKR",
            "platformId": "9da3a8a7-4795-43e3-a6db-ccb914189737"
        }