GmxV2
You can import the GmxV2 environment by running:
env = GmxV2Env(
chain=Chain.ARBITRUM,
block_range=block_range,
agents=[market_agent, agent1],
market_venues=[market_venue],
backend_type="forked",
)
It is recommended to read the GmxV2 docs first.
Market venues
GMX provides different markets. As seen above, the GMX environment expects the specification of a market venue.
This could look like:
market_venue = MarketVenue(
long_token="WETH",
short_token="USDC",
index_token="WETH",
)
Actions
For a complete list of supported actions, please refer to the code reference.
if gm_token_value < Decimal(1.5) and self.state == State.NO_POSITION:
self.state = State.POSITION_OPEN
return [
GmxDeposit(
agent=self.agent,
market_key="WETH:WETH:USDC",
initial_long_token_symbol="WETH",
initial_short_token_symbol="USDC",
long_token_usd=Decimal(100),
short_token_usd=Decimal(100),
observations=obs,
)
]
if self.state is State.POSITION_OPEN and self.count > 30:
self.state = State.FINISH
return [
GmxWithdrawal(
agent=self.agent,
market_key="WETH:WETH:USDC",
gm_token_amount=Decimal(100),
)
]