Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError("order.price must be finite and greater than 0") #754

Open
homerokzam opened this issue Nov 4, 2024 · 0 comments
Open

ValueError("order.price must be finite and greater than 0") #754

homerokzam opened this issue Nov 4, 2024 · 0 comments

Comments

@homerokzam
Copy link

homerokzam commented Nov 4, 2024

My code:

...
df_close_filtered = df_closes[df_closes.index >= reference_date].values
df_price_filtered = df_prices[df_prices.index >= reference_date].values
df_size_filtered = df_portfolio_orders[df_portfolio_orders.index >= reference_date].values
portfolio = vbt.Portfolio.from_orders(close = df_close_filtered, price = df_price_filtered, size = df_size_filtered, size_type='Amount', init_cash='autoalign', freq = 'D')
...

I'm getting the exception: raise ValueError("order.price must be finite and greater than 0")

But testing the values of df_price_filtered as follows:

mask_combinada = (df_price_filtered < 0) | (~np.isfinite(df_price_filtered))
linhas_com_issues = df_price_filtered[mask_combinada.any(axis=1)]
if not linhas_com_issues.empty:
print("\nLines with values less than 0 or not finite:")
print(linhas_com_issues)
else:
print("\nNo line contains values less than 0 or not finite.")

I'm getting the answer: No line contains values less than 0 or not finite.

Python: 3.11.9
vectorbt: 0.26.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant