-
Notifications
You must be signed in to change notification settings - Fork 186
Open
Description
: smm/quote_generators/plain.py
` def generate_positive_skew_quotes(self, skew: float, spread: float) -> List[Tuple]:
"""
Generate positively skewed bid/ask quotes, with the intention to fill
more on the bid side (buy more) than the ask side (sell less). A larger strategy
breakdown can be found in the README.md, or at the top of this class.
Parameters
----------
skew : float
A value > 0 predicting the future price over some time horizon.
spread : float
A value in dollars of minimum price deviation over some time horizon.
Returns
-------
List[Dict]
A list of single quotes.
"""
half_spread = spread / 2
aggressiveness = self.params["aggressiveness"] * (skew**0.5)
best_bid_price = self.mid - (half_spread * (1.0 - aggressiveness))
best_ask_price = best_bid_price + spread
bid_prices = nbgeomspace(
start=best_bid_price,
end=best_bid_price - (spread * 5),
n=self.total_orders // 2,
)
ask_prices = nbgeomspace(
start=best_ask_price,
end=best_ask_price + (spread * 5),
n=self.total_orders // 2,
)
clipped_r = 0.5 + nbclip(skew, 0.0, 0.5) # NOTE: Geometric ratio cant exceed 1.0
bid_sizes = self.max_position * generate_geometric_weights(
num=self.total_orders // 2, r=clipped_r, reverse=True
)
ask_sizes = self.max_position * generate_geometric_weights(
num=self.total_orders // 2,
r=0.5 + (clipped_r ** (2 + aggressiveness)),
reverse=True,
)
return self.prepare_orders(bid_prices, bid_sizes, ask_prices, ask_sizes)`
Metadata
Metadata
Assignees
Labels
No labels