mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-22 12:40:30 +08:00
Compare commits
3
Commits
pandas_0.22.0
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fbb6f5134 | ||
|
|
af7b211035 | ||
|
|
4eaec97614 |
@@ -1,4 +1,5 @@
|
|||||||
import abc
|
import abc
|
||||||
|
import datetime
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@@ -300,20 +301,34 @@ class DataPortalExchangeBacktest(DataPortalExchangeBase):
|
|||||||
)
|
)
|
||||||
adj_bar_count = candle_size * bar_count
|
adj_bar_count = candle_size * bar_count
|
||||||
|
|
||||||
if data_frequency == 'minute' and adj_data_frequency == 'daily':
|
if data_frequency == "minute":
|
||||||
end_dt = end_dt.floor('1D')
|
# for minute frequency always request data until the
|
||||||
|
# current minute (do not include the current minute)
|
||||||
|
last_dt_for_series = end_dt - datetime.timedelta(minutes=1)
|
||||||
|
|
||||||
|
# read the minute bundles for daily frequency to
|
||||||
|
# support last partial candle
|
||||||
|
# TODO: optimize this by applying this logic only for the last day
|
||||||
|
if adj_data_frequency == 'daily':
|
||||||
|
adj_data_frequency = 'minute'
|
||||||
|
adj_bar_count = adj_bar_count * 1440
|
||||||
|
|
||||||
|
else: # data_frequency == "daily":
|
||||||
|
last_dt_for_series = end_dt
|
||||||
|
|
||||||
series = bundle.get_history_window_series_and_load(
|
series = bundle.get_history_window_series_and_load(
|
||||||
assets=assets,
|
assets=assets,
|
||||||
end_dt=end_dt,
|
end_dt=last_dt_for_series,
|
||||||
bar_count=adj_bar_count,
|
bar_count=adj_bar_count,
|
||||||
field=field,
|
field=field,
|
||||||
data_frequency=adj_data_frequency,
|
data_frequency=adj_data_frequency,
|
||||||
algo_end_dt=self._last_available_session,
|
algo_end_dt=self._last_available_session,
|
||||||
)
|
)
|
||||||
|
|
||||||
start_dt = get_start_dt(end_dt, adj_bar_count, adj_data_frequency)
|
start_dt = get_start_dt(last_dt_for_series, adj_bar_count,
|
||||||
|
adj_data_frequency, False)
|
||||||
df = resample_history_df(pd.DataFrame(series), freq, field, start_dt)
|
df = resample_history_df(pd.DataFrame(series), freq, field, start_dt)
|
||||||
|
|
||||||
return df
|
return df
|
||||||
|
|
||||||
def get_exchange_spot_value(self,
|
def get_exchange_spot_value(self,
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
Release Notes
|
Release Notes
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
Version 0.5.8
|
||||||
|
^^^^^^^^^^^^^
|
||||||
|
**Release Date**: 2018-03-29
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
~~~~~~~~~
|
||||||
|
- Fix Data Marketplace release on mainnet
|
||||||
|
|
||||||
Version 0.5.7
|
Version 0.5.7
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
**Release Date**: 2018-03-29
|
**Release Date**: 2018-03-29
|
||||||
@@ -14,7 +22,7 @@ Build
|
|||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
- Added arguments to the ``reduce`` function in tha Asset class :issue:`214`,
|
- fixes in storing and loading the state :issue:`214`,
|
||||||
:issue:`287`
|
:issue:`287`
|
||||||
|
|
||||||
Version 0.5.6
|
Version 0.5.6
|
||||||
|
|||||||
Reference in New Issue
Block a user