Skip to content

Commit

Permalink
Add tag test
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Oct 20, 2024
1 parent d476fce commit 9d8d930
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/backtest/test_custom_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def decide_trades(input: StrategyInput) -> list[TradeExecution]:
pass

# Unit test asserts
import ipdb ; ipdb.set_trace()
assert pair.get_tags() == {"L1", "evm", "bluechip"}
assert pair.base.get_tags() == {"L1", "evm", "bluechip"}

Expand Down
16 changes: 15 additions & 1 deletion tradeexecutor/state/identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,21 @@ class AssetIdentifier:
As internal token_ids and pair_ids may be unstable, trading pairs and tokens are explicitly
referred by their smart contract addresses when a strategy decision moves to the execution.
We duplicate data here to make sure we have a persistent record that helps to diagnose the sisues.
We duplicate data here to make sure we have a persistent record that helps to diagnose the issues.
Setting custom data:
- Both :py:class:`AssetIdentifier` and :py:class:`TradingPairIdentifier` offer :py:attr:`AssetIdentifier.other_data` allowing you to set custom attribtues.
- You must set these attributes in `create_trading_universe` function.
- For more information see `test_custom_labels`.
Example:
.. code-block:: python
"""

#: See https://chainlist.org/
Expand Down

0 comments on commit 9d8d930

Please sign in to comment.