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

Instrument - Exception: No stream satisfies selector condition. #470

Open
autronix opened this issue Apr 18, 2024 · 0 comments
Open

Instrument - Exception: No stream satisfies selector condition. #470

autronix opened this issue Apr 18, 2024 · 0 comments

Comments

@autronix
Copy link

Hello,

I'm attempting to run the following code:

from tensortrade.oms.instruments import USD, Instrument
from tensortrade.oms.wallets import Wallet, Portfolio
from tensortrade.oms.exchanges import Exchange
from tensortrade.feed.core import DataFeed, Stream
from tensortrade.oms.services.execution.simulated import execute_order
from tensortrade.env.default import create
import tensortrade.env.default as default

# Instrument and Symbol
symbol = 'AAPL'
AAPL = Instrument(symbol, 2, symbol)

# Data Stream
data = [150, 152, 153, 151, 150]  # Example price data
price_stream = Stream.source(data, dtype="float").rename("USD-AAPL")

# Data Feed
feed = DataFeed([price_stream])

# Exchange
exchange = Exchange("simulated", service=execute_order)(feed)

# Wallets
portfolio = Portfolio(USD, [
    Wallet(exchange, 10000 * USD),
    Wallet(exchange, 10 * AAPL)
])

# Environment
env = create(
    feed=feed,
    portfolio=portfolio,
    action_scheme=default.actions.SimpleOrders(),
    reward_scheme=default.rewards.SimpleProfit(),
    window_size=10
)

# Testing the environment
observation = env.reset()
print("Initial observation:", observation)
action = env.action_space.sample()
next_state, reward, done, info = env.step(action)
print("Next state:", next_state)
print("Reward:", reward)

Every time I run the code I get the following error: Exception: No stream satisfies selector condition.

I can't seem to figure out what I am missing and the documentation doesn't seem to cover any examples that do this kind of use case.

Thanks

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