Skip to content

Commit

Permalink
Merge branch 'futures_dev' of github.com:bug-or-feature/pysystemtrade…
Browse files Browse the repository at this point in the history
… into futures_dev
  • Loading branch information
bug-or-feature committed Jan 27, 2025
2 parents da2985a + 7a85874 commit af79df3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions syscore/pandas/frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ def merge_data_with_different_freq(
"""

filtered = [item for item in list_of_data if len(item) > 0]
if len(filtered) > 1:
list_as_concat_pd = pd.concat(filtered, axis=0)
else:
if len(filtered) == 0:
return pd.DataFrame()
elif len(filtered) == 1:
list_as_concat_pd = filtered[0]
else:
list_as_concat_pd = pd.concat(filtered, axis=0)
sorted_pd = list_as_concat_pd.sort_index()
unique_pd = uniquets(sorted_pd)

Expand Down
8 changes: 5 additions & 3 deletions sysproduction/update_historical_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,11 @@ def write_merged_prices_for_contract(

merged_prices = merge_data_with_different_freq(list_of_data)

price_updater.overwrite_merged_prices_for_contract(
contract_object=contract_object, new_prices=futuresContractPrices(merged_prices)
)
if len(merged_prices) > 0:
price_updater.overwrite_merged_prices_for_contract(
contract_object=contract_object,
new_prices=futuresContractPrices(merged_prices),
)


if __name__ == "__main__":
Expand Down

0 comments on commit af79df3

Please sign in to comment.