TimelordUK / jspurefix

native typescript FIX engine
MIT License
61 stars 28 forks source link

Generator does not compile forward referenced components #62

Open dondopong opened 1 year ago

dondopong commented 1 year ago

When there's a component inside another one, and the referenced component is declared after the main component in the xml, the generator does not compile it properly. Example:

    <component name="BaseTradingRules">
      <component name="TickRules" required="N" />
      <component name="LotTypeRules" required="N" />
      <component name="PriceLimits" required="N" />
      <field name="ExpirationCycle" required="N" />
      <field name="MinTradeVol" required="N" />
      <field name="MaxTradeVol" required="N" />
      <field name="MaxPriceVariation" required="N" />
      <field name="ImpliedMarketIndicator" required="N" />
      <field name="TradingCurrency" required="N" />
      <field name="RoundLot" required="N" />
      <field name="MultilegModel" required="N" />
      <field name="MultilegPriceMethod" required="N" />
      <field name="PriceType" required="N" />
    </component>

    <component name="TickRules">
      <group name="NoTickRules" required="N">
        <field name="StartTickPriceRange" required="N" />
        <field name="EndTickPriceRange" required="N" />
        <field name="TickIncrement" required="N" />
        <field name="TickRuleType" required="N" />
      </group>
    </component>

The output looks like this:

export interface IBaseTradingRules {
  ExpirationCycle?: number// [1] 827 (Int)
  MinTradeVol?: number// [2] 562 (Float)
  MaxTradeVol?: number// [3] 1140 (Float)
  MaxPriceVariation?: number// [4] 1143 (Float)
  ImpliedMarketIndicator?: number// [5] 1144 (Int)
  TradingCurrency?: string// [6] 1245 (String)
  RoundLot?: number// [7] 561 (Float)
  MultilegModel?: number// [8] 1377 (Int)
  MultilegPriceMethod?: number// [9] 1378 (Int)
  PriceType?: number// [10] 423 (Int)
}

Workaround for this: place the referenced component before the main component in the xml file.

TimelordUK commented 1 year ago

this has finally been fixed on the fix52 branch where your original file is now parsing with forward references

hope to merge and release soon.

export interface IBaseTradingRules {
  TickRules?: ITickRules// [1] NoTickRules.1205, StartTickPriceRange.1206 .. TickRuleType.1209
  LotTypeRules?: ILotTypeRules// [2] NoLotTypeRules.1234, LotType.1093 .. MaxLotSize.5515
  PriceLimits?: IPriceLimits// [3] PriceLimitType.1306, LowLimitPrice.1148 .. TradingReferencePrice.1150
  ExpirationCycle?: number// [4] 827 (Int)
  MinTradeVol?: number// [5] 562 (Float)
  MaxTradeVol?: number// [6] 1140 (Float)
  MaxPriceVariation?: number// [7] 1143 (Float)
  ImpliedMarketIndicator?: number// [8] 1144 (Int)
  TradingCurrency?: string// [9] 1245 (String)
  RoundLot?: number// [10] 561 (Float)
  MultilegModel?: number// [11] 1377 (Int)
  MultilegPriceMethod?: number// [12] 1378 (Int)
  PriceType?: number// [13] 423 (Int)
}
dondopong commented 1 year ago

Thank you very much! I'll hopefully be testing it in a few weeks.

El vie, 3 de nov de 2023, 14:30, TimelordUK @.***> escribió:

this has finally been fixed on the fix52 branch where your original file is now parsing with forward references

hope to merge and release soon.

export interface IBaseTradingRules { TickRules?: ITickRules// [1] NoTickRules.1205, StartTickPriceRange.1206 .. TickRuleType.1209 LotTypeRules?: ILotTypeRules// [2] NoLotTypeRules.1234, LotType.1093 .. MaxLotSize.5515 PriceLimits?: IPriceLimits// [3] PriceLimitType.1306, LowLimitPrice.1148 .. TradingReferencePrice.1150 ExpirationCycle?: number// [4] 827 (Int) MinTradeVol?: number// [5] 562 (Float) MaxTradeVol?: number// [6] 1140 (Float) MaxPriceVariation?: number// [7] 1143 (Float) ImpliedMarketIndicator?: number// [8] 1144 (Int) TradingCurrency?: string// [9] 1245 (String) RoundLot?: number// [10] 561 (Float) MultilegModel?: number// [11] 1377 (Int) MultilegPriceMethod?: number// [12] 1378 (Int) PriceType?: number// [13] 423 (Int)}

— Reply to this email directly, view it on GitHub https://github.com/TimelordUK/jspurefix/issues/62#issuecomment-1792855971, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGN5Y3VTQF7ZH3OSBDDK6STYCUS27AVCNFSM6AAAAAAVMVG6XWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJSHA2TKOJXGE . You are receiving this because you authored the thread.Message ID: @.***>