Options
All
  • Public
  • Public/Protected
  • All
Menu

Module trades/getFamilyMaps

Index

Functions

Functions

default

  • default(trades: TradeRecords): FamilyMaps
  • Group all trades into what is called a "family" keyed by sl. In other words all trades with the same stop loss belong to the same family.

    Example, the following nine (9) orders:

    1. Order 314327066 314307379 314327066 BUY GOLD @ 1782.07 SL 1765 TP 1797
    2. Order 314327067 314307378 314327067 BUY GOLD @ 1782.07 SL 1765 TP 1792
    3. Order 314327068 314307377 314327068 BUY GOLD @ 1782.07 SL 1765 TP 1789
    4. Order 314327069 314307375 314327069 BUY GOLD @ 1782.07 SL 1765 TP 1786
    5. Order 314327070 314307374 314327070 BUY GOLD @ 1782.07 SL 1765 TP 1784
    6. Order 314391975 314391975 314391975 SELL_STOP ETHEREUM @ 4200 SL 4800 TP 4140
    7. Order 314391976 314391976 314391976 SELL_STOP ETHEREUM @ 4200 SL 4800 TP 4100
    8. Order 314391977 314391977 314391977 SELL_STOP ETHEREUM @ 4200 SL 4800 TP 4150
    9. Order 314391978 314391978 314391978 SELL_STOP ETHEREUM @ 4200 SL 4800 TP 4160

    produce two (2) familys:

      SL 1765 ['BUY'] ['GOLD'] TPs [ 1784, 1786, 1789, 1792, 1797 ]
    SL 4800 ['SELL_STOP'] ['ETHEREUM'] TPs [ 4160, 4150, 4140, 4100 ]
    seealso

    getFamilyTrades

    todo

    This functionality might be better served by grouping on the position field or even the customComment field but unfortunately these fields are unreliable.

    Parameters

    • trades: TradeRecords

    Returns FamilyMaps

    a 3-member Tuple of Maps keyed on stop loss

    [ tpMap, typeMap, symbolMap ]

    Example:

    [
    Map(2) { 1765 => [ 1784, 1786, 1789, 1792, 1797 ],
    4800 => [ 4160, 4150, 4140, 4100 ] },
    Map(2) { 1765 => [ 'BUY' ], 4800 => [ 'SELL_STOP' ] },
    Map(2) { 1765 => [ 'GOLD' ], 4800 => [ 'ETHEREUM' ] }
    ]

Generated using TypeDoc