Skip to content

chaseltb/prosperity3

Repository files navigation

prosperity3

Our team placed in the top 9% of Prosperity 3!

Prosperity instructions:

https://imc-prosperity.notion.site/Writing-an-Algorithm-in-Python-19ee8453a0938114a15eca1124bf28a1

Overview of the Trader class

The class only requires a single method called run, which is called by the simulation every time a new TraderState is available. The logic within this run method is written by the player and determines the behaviour of the algorithm. The output of the method is a dictionary named result, which contains all the orders that the algorithm decides to send based on this logic.

Example of Trading

For the following example we assume a situation with two products:

  • PRODUCT1 with position limit 10
  • PRODUCT2 with position limit 20

At the start of the first iteration the run method is called with the TradingState generated by the below code. Note: the datamodel.py file from which the classes are imported is provided in Appendix B. The code can also be used to test algorithms locally.

from datamodel import Listing, OrderDepth, Trade, TradingState

timestamp = 1000

listings = { "PRODUCT1": Listing( symbol="PRODUCT1", product="PRODUCT1", denomination= "SEASHELLS" ), "PRODUCT2": Listing( symbol="PRODUCT2", product="PRODUCT2", denomination= "SEASHELLS" ), }

order_depths = { "PRODUCT1": OrderDepth( buy_orders={10: 7, 9: 5}, sell_orders={11: -4, 12: -8} ), "PRODUCT2": OrderDepth( buy_orders={142: 3, 141: 5}, sell_orders={144: -5, 145: -8} ), }

own_trades = { "PRODUCT1": [], "PRODUCT2": [] }

market_trades = { "PRODUCT1": [ Trade( symbol="PRODUCT1", price=11, quantity=4, buyer="", seller="", timestamp=900 ) ], "PRODUCT2": [] }

position = { "PRODUCT1": 3, "PRODUCT2": -5 }

observations = {} traderData = ""

state = TradingState( traderData, timestamp, listings, order_depths, own_trades, market_trades, position, observations )

About

IMC Prosperity's Algorithmic Trading Competition. Placed in the top 9% with no experience in quant!

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages