Support capped-fee #1
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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.
Design of
CappedAmountinstanceHow to configure.
Index figure.
When to update.
CappedFeeSpecandCappedFeeOther 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)