@@ -2,6 +2,8 @@ use std::{ffi::c_void, mem::size_of, ptr::slice_from_raw_parts_mut};
2
2
3
3
pub use backtest:: * ;
4
4
pub use depth:: * ;
5
+ #[ cfg( feature = "live" ) ]
6
+ use hftbacktest:: live:: { Instrument , LiveBotBuilder } ;
5
7
use hftbacktest:: {
6
8
backtest:: {
7
9
assettype:: { InverseAsset , LinearAsset } ,
@@ -38,17 +40,18 @@ use hftbacktest::{
38
40
Backtest ,
39
41
DataSource ,
40
42
} ,
41
- live:: { Instrument , LiveBotBuilder } ,
42
43
prelude:: { ApplySnapshot , Event , HashMapMarketDepth , ROIVectorMarketDepth } ,
43
44
} ;
44
45
use hftbacktest_derive:: build_asset;
45
46
pub use order:: * ;
46
47
use pyo3:: { exceptions:: PyValueError , prelude:: * } ;
47
48
49
+ #[ cfg( feature = "live" ) ]
48
50
use crate :: live:: { HashMapMarketDepthLiveBot , ROIVectorMarketDepthLiveBot } ;
49
51
50
52
mod backtest;
51
53
mod depth;
54
+ #[ cfg( feature = "live" ) ]
52
55
mod live;
53
56
mod order;
54
57
@@ -454,7 +457,9 @@ impl BacktestAsset {
454
457
fn _hftbacktest ( m : & Bound < ' _ , PyModule > ) -> PyResult < ( ) > {
455
458
m. add_function ( wrap_pyfunction ! ( build_hashmap_backtest, m) ?) ?;
456
459
m. add_function ( wrap_pyfunction ! ( build_roivec_backtest, m) ?) ?;
460
+ #[ cfg( feature = "live" ) ]
457
461
m. add_function ( wrap_pyfunction ! ( build_hashmap_livebot, m) ?) ?;
462
+ #[ cfg( feature = "live" ) ]
458
463
m. add_function ( wrap_pyfunction ! ( build_roivec_livebot, m) ?) ?;
459
464
m. add_class :: < BacktestAsset > ( ) ?;
460
465
m. add_class :: < LiveInstrument > ( ) ?;
@@ -658,6 +663,7 @@ impl LiveInstrument {
658
663
}
659
664
}
660
665
666
+ #[ cfg( feature = "live" ) ]
661
667
#[ pyfunction]
662
668
pub fn build_hashmap_livebot ( instruments : Vec < PyRefMut < LiveInstrument > > ) -> PyResult < usize > {
663
669
let mut builder = LiveBotBuilder :: new ( ) ;
@@ -680,6 +686,7 @@ pub fn build_hashmap_livebot(instruments: Vec<PyRefMut<LiveInstrument>>) -> PyRe
680
686
Ok ( Box :: into_raw ( Box :: new ( hbt) ) as * mut c_void as usize )
681
687
}
682
688
689
+ #[ cfg( feature = "live" ) ]
683
690
#[ pyfunction]
684
691
pub fn build_roivec_livebot ( instruments : Vec < PyRefMut < LiveInstrument > > ) -> PyResult < usize > {
685
692
let mut builder = LiveBotBuilder :: new ( ) ;
0 commit comments