Skip to content

Conversation

@MrQuansy
Copy link
Owner

@MrQuansy MrQuansy commented Jul 7, 2024

Background

We want to support a new fee type: capped-fee in jetrate. This fee has different fee calculation approaches depending on the current trading volume/fee aggregation value of a group of symbols. Before the aggregation value reaching the threshold, the fee calculation uses the first and after uses another.

An example Json format is following:
{ "name": "John Doe", "age": 30, "email": "[email protected]", "address": { "street": "123 Main St", "city": "Anytown", "state": "CA", "zip": "12345" }, "phoneNumbers": [ { "type": "home", "number": "555-555-5555" }, { "type": "work", "number": "555-555-5556" } ], "hobbies": ["reading", "traveling", "coding"] }

Design

  1. Load aggregation results from CSV file
    jetrate uses the daily pipeline in Azkaban to
    to get the aggregation value through our fee database (clickhouse).
    We will set path file to archieve spec, and load the CSV file.
    Store all CappedSpecs in feecalcconfig when creating.

  2. Design of CappedAmount instance
    How to configure.
    Index figure.
    When to update.

  3. CappedFeeSpec and CappedFee

  4. Other detail
    How to configure.
    Now, we don't want capped-fee to support conspec.
    We don't support each day archieve.
    Use macro: #JETRATE_ENABLE_CAPPED_FEE, if define to 0, it will cause no cost to existing calculation.

Test

Use Python unit test + pybind to test CappedFee validation for the json format.
Add test(schedules.json, mock prime server, order event, example csv)

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

Successfully merging this pull request may close these issues.

2 participants