Last active
July 18, 2023 02:14
-
-
Save JulianJesacher/d480c5f66bb9ca3b7a1e4288cb31b177 to your computer and use it in GitHub Desktop.
HFT Challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContestantTrader(Trader): | |
def __init__(self, name, prediction_offness, capital=10000): | |
super().__init__(name, capital) | |
self.trades = [] | |
self.total_asset_value = capital | |
# guess on dividends | |
self.prediction_offness = prediction_offness | |
self.dividend_estimate = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Order: | |
def __init__(self, marketmaker_name, order_time, qty, order_type, direction, valid_until, order_price=0, **kwargs): | |
# default values on the order | |
self.marketmaker_name = marketmaker_name | |
self.order_time = order_time | |
self.qty = qty | |
self.order_type = order_type # this can be a market or limit order, specified by 'M' or 'L' | |
self.direction = direction # this is either 'B' for buy, or 'S' for sell | |
self.valid_until = valid_until # this is the time step it is valid until | |
# for a market order, a price is not required. For a limit order, we will require a price. | |
# market orders are used just in case on a given day you think that you will take any | |
# bid or ask just to get out or get into a position asap | |
self.order_price = order_price |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_quotes(self, time, current_price=0, orderbook=None): | |
# The `create_quotes` function is used to generate quotes for a trader. | |
# The parameters that you know as a trader are: | |
# - time: the current time in the trading environment | |
# - current_price: the current price of the stock | |
# - orderbook: the current state of the order book, including all outstanding orders and their details | |
# - self.dividend_estimate: your initial predicted dividend prediction on the day that the last dividend was paid out at. | |
# You will also know any variable defined in the __init__ function. | |
# The function should return a list of quotes in the following format: | |
# [{'order_time': int, 'qty': int, 'order_type': 'L' or 'M', | |
# 'direction': 'B' or 'S', 'valid_until': int, 'order_price': float}] | |
# The market maker name will be added via the world environment | |
# If you decide not to make any bids, please return an empty list, i.e. [] | |
return [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment