Skip to content

Commit

Permalink
feat(py): add live trading feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaz001 committed Oct 6, 2024
1 parent 67e5ab4 commit 9d3dbd3
Show file tree
Hide file tree
Showing 4 changed files with 1,642 additions and 2 deletions.
29 changes: 28 additions & 1 deletion py-hftbacktest/hftbacktest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
from ._hftbacktest import (
BacktestAsset as BacktestAsset_,
build_hashmap_backtest,
build_roivec_backtest
build_roivec_backtest,
LiveInstrument,
build_hashmap_livebot,
build_roivec_livebot
)
from .binding import (
HashMapMarketDepthBacktest_,
HashMapMarketDepthBacktest as HashMapMarketDepthBacktest_TypeHint,
ROIVectorMarketDepthBacktest_,
ROIVectorMarketDepthBacktest as ROIVectorMarketDepthBacktest_TypeHint,
HashMapMarketDepthLiveBot_,
HashMapMarketDepthLiveBot as HashMapMarketDepthLiveBot_TypeHint,
ROIVectorMarketDepthLiveBot_,
ROIVectorMarketDepthLiveBot as ROIVectorMarketDepthLiveBot_TypeHint,
event_dtype
)
from .order import (
Expand Down Expand Up @@ -52,6 +59,10 @@
'HashMapMarketDepthBacktest',
'ROIVectorMarketDepthBacktest',

'LiveInstrument',
'HashMapMarketDepthLiveBot',
'ROIVectorMarketDepthLiveBot',

'ALL_ASSETS',

# Event flags
Expand Down Expand Up @@ -196,3 +207,19 @@ def ROIVectorMarketDepthBacktest(
"""
ptr = build_roivec_backtest(assets)
return ROIVectorMarketDepthBacktest_(ptr)


def ROIVectorMarketDepthLiveBot(
assets: List[LiveInstrument]
) -> ROIVectorMarketDepthLiveBot_TypeHint:
"""
Constructs an instance of `ROIVectorMarketDepthLiveBot`.
Args:
assets: A list of live instruments constructed using :class:`LiveInstrument`.
Returns:
A jit`ed `ROIVectorMarketDepthLiveBot` that can be used in an ``njit`` function.
"""
ptr = build_roivec_livebot(assets)
return ROIVectorMarketDepthLiveBot_(ptr)
Loading

0 comments on commit 9d3dbd3

Please sign in to comment.