Skip to content

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

@autronix

Description

@autronix

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions