92 lines
3.8 KiB
Python
92 lines
3.8 KiB
Python
# defines the schema to submit a new strategy to the system
|
|
__SUBMIT_STRATEGY_SCHEMA__ = {
|
|
"$id": "http://example.com/example.json",
|
|
"type": "object",
|
|
"definitions": {},
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"properties": {
|
|
"user": {
|
|
"$id": "/properties/user",
|
|
"type": "string",
|
|
"title": "The User Schema ",
|
|
"default": "",
|
|
"examples": [
|
|
"GCU4LW2XXZW3A3FM2XZJTEJHNWHTWDKY2DIJLCZJ5ULVZ4K7LZ7D23TG"
|
|
]
|
|
},
|
|
"description": {
|
|
"$id": "/properties/description",
|
|
"type": "string",
|
|
"title": "The Description Schema ",
|
|
"default": "",
|
|
"examples": [
|
|
"simple test strategy"
|
|
]
|
|
},
|
|
"exchange": {
|
|
"$id": "/properties/exchange",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"$id": "/properties/exchange/properties/name",
|
|
"type": "string",
|
|
"title": "The Name Schema ",
|
|
"default": "",
|
|
"examples": [
|
|
"binance"
|
|
]
|
|
},
|
|
"stake": {
|
|
"$id": "/properties/exchange/properties/stake",
|
|
"type": "string",
|
|
"title": "The Stake Schema ",
|
|
"default": "",
|
|
"examples": [
|
|
"usdt"
|
|
]
|
|
},
|
|
"pairs": {
|
|
"$id": "/properties/exchange/properties/pairs",
|
|
"type": "array",
|
|
"items": {
|
|
"$id": "/properties/exchange/properties/pairs/items",
|
|
"type": "string",
|
|
"title": "The 0th Schema ",
|
|
"default": "",
|
|
"examples": [
|
|
"btc/usdt"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"name": {
|
|
"$id": "/properties/name",
|
|
"type": "string",
|
|
"title": "The Name Schema ",
|
|
"default": "",
|
|
"examples": [
|
|
"MyFancyTestStrategy"
|
|
]
|
|
},
|
|
"content": {
|
|
"$id": "/properties/content",
|
|
"type": "string",
|
|
"title": "The Content Schema ",
|
|
"default": "",
|
|
"examples": [
|
|
"IyA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ICAgIHF0cHlsaWIuY3Jvc3NlZF9hYm92ZShkYXRhZnJhbWVbJ21hU2hvcnQnXSwgZGF0YWZyYW1lWydtYU1lZGl1bSddKQogICAgICAgICAgICApLAogICAgICAgICAgICAnYnV5J10gPSAxCgogICAgICAgIHJldHVybiBkYXRhZnJhbWUKCiAgICBkZWYgcG9wdWxhdGVfc2VsbF90cmVuZChzZWxmLCBkYXRhZnJhbWU6IERhdGFGcmFtZSkgLT4gRGF0YUZyYW1lOgogICAgICAgIGRhdGFmcmFtZS5sb2NbCiAgICAgICAgICAgICgKICAgICAgICAgICAgICAgIHF0cHlsaWIuY3Jvc3NlZF9hYm92ZShkYXRhZnJhbWVbJ21hTWVkaXVtJ10sIGRhdGFmcmFtZVsnbWFTaG9ydCddKQogICAgICAgICAgICApLAogICAgICAgICAgICAnc2VsbCddID0gMQogICAgICAgIHJldHVybiBkYXRhZnJhbWUKCgogICAgICAgIA=="
|
|
]
|
|
},
|
|
"public": {
|
|
"$id": "/properties/public",
|
|
"type": "boolean",
|
|
"title": "The Public Schema ",
|
|
"default": False,
|
|
"examples": [
|
|
False
|
|
]
|
|
}
|
|
}
|
|
}
|