Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about check_last_bidirectional_trade_thresh_hold parameter of start_simple_market_maker_bot #305

Open
gcharang opened this issue Jul 31, 2024 · 0 comments
Assignees

Comments

@gcharang
Copy link
Collaborator

Trade Analysis:

  • The bot evaluates the last 1000 trades for both base/rel and rel/base pairs (up to 2000 total).

VWAP Calculation:

  • For each pair, the VWAP is computed by taking the sum of the product of each trade's price and volume (sum(price * volume)) and dividing it by the total volume (sum(volume)).
  • When calculating the VWAP for the reverse pair (rel/base), the bot considers its own base asset as the reference, and it gets the price for the base asset.
  • Combines/sums the separate VWAPs for base/rel and rel/base trades into a total VWAP.

Price Comparison:

  • Compares total VWAP to the bot's calculated price (price from price service * spread).
  • If VWAP > calculated price, uses VWAP for order price.

Liquidity Adjustment:

  • By setting the price of one pair to the VWAP price, the bot adjusts market maker orders above the market rate for one direction to encourage trades in the opposite direction, addressing temporary liquidity imbalances until equilibrium is restored.

Future improvements could include:

  • Adjusting the VWAP by balancing the difference through buying from a CEX.
  • Including these CEX purchases in VWAP calculations.
  • Defining a threshold (e.g., 60%/40%) for triggering a CEX buy to balance the pair.
@gcharang gcharang self-assigned this Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant