mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-12 12:12:04 +08:00
ENH: Add basis for minute rate emission of performance.
- Create different benchmark containers in performance depending on emission rate. - Add a minute close method which updates algorithm and benchmark returns, and calculates the risk metrics depending on those methods. - Provide fake 0.0 values for annualized metrics like sharpe, sortino, and information, until we figure out how they should be treated in the context of minutely calculation. *NOTE* This does not fully work without the changes to the simulation loop by @fawce
This commit is contained in:
@@ -1047,19 +1047,31 @@ class TestPerformanceTracker(unittest.TestCase):
|
||||
dt=foo_event_1.dt,
|
||||
price=10.0,
|
||||
commission=0.50)
|
||||
benchmark_event_1 = Event({
|
||||
'dt': start_dt,
|
||||
'returns': 1.0,
|
||||
'type': DATASOURCE_TYPE.BENCHMARK
|
||||
})
|
||||
|
||||
foo_event_2 = factory.create_trade(
|
||||
'foo', 11.0, 20, start_dt + datetime.timedelta(minutes=1))
|
||||
bar_event_2 = factory.create_trade(
|
||||
'bar', 11.0, 20, start_dt + datetime.timedelta(minutes=1))
|
||||
benchmark_event_2 = Event({
|
||||
'dt': start_dt + datetime.timedelta(minutes=1),
|
||||
'returns': 2.0,
|
||||
'type': DATASOURCE_TYPE.BENCHMARK
|
||||
})
|
||||
|
||||
events = [
|
||||
foo_event_1,
|
||||
order_event_1,
|
||||
benchmark_event_1,
|
||||
txn_event_1,
|
||||
bar_event_1,
|
||||
foo_event_2,
|
||||
bar_event_2
|
||||
benchmark_event_2,
|
||||
bar_event_2,
|
||||
]
|
||||
|
||||
messages = {date: snapshot[-1].perf_messages[0] for date, snapshot in
|
||||
|
||||
Reference in New Issue
Block a user