Closed fordN closed 1 year ago
A labelled JSON output data structure might look something like the following example. This is just an example, the keys and strategy names can probably be simplified further.
{
"strategies": [
{
"name": "existing_strategy",
"expected_profit_per_period": 246605.9300211147,
"expected_apr": 0.1291681625266914,
"allocations": [
{
"deploymentID": "QmTBxvMF6YnbT1eYeRx9XQpH4WvxTV53vdptCCZFiZSprg",
"allocationAmount": "4218651",
"expected_profit_per_period": 53229.55413337927,
"expected_apr": 0.16487118063215364
},
{
"deploymentID": "QmRhh7rFt3qxfRMTZvHRNK6jCobX4Gx5TkzWXhZkuj57w8",
"allocationAmount": "12522623",
"expected_profit_per_period": 130553.90155360787,
"expected_apr": 0.13699710274859847
}
]
},
{
"name": "new_strategy_6_allocations",
"expected_profit_per_period": 413929.68936109636,,,
"expected_apr": 0.21680961761722076,
"allocations": [
{
"deploymentID": "QmXZiV6S13ha6QXq4dmaM3TB4CHcDxBMvGexSNu9Kc28EH",
"allocationAmount": "5311929.838545",
"expected_profit_per_period": 89780.36601669162,
"expected_apr": 0.2203250486043537
},
{
"deploymentID": "Qmaz1R8vcv9v3gUfksqiS9JUz7K9G8S5By3JYn8kTiiP5K",
"allocationAmount": "4385760.163346",
"expected_profit_per_period": 72764.35324804833,
"expected_apr": 0.21627614912773396
},
{
"deploymentID": "Qmadj8x9km1YEyKmRnJ6EkC2zpJZFCfTyTZpuqC3j6e1QH",
"allocationAmount": "6612684.635432",
"expected_profit_per_period": 115130.17297597142,
"expected_apr": 0.22695835705486095
},
{
"deploymentID": "QmUVskWrz1ZiQZ76AtyhcfFDEH1ELnRpoyEhVL8p6NFTbR",
"allocationAmount": "2936322.616433",
"expected_profit_per_period": 46701.48504127977,
"expected_apr": 0.20732981189110403
},
{
"deploymentID": "QmcPHxcC2ZN7m79XfYZ77YmF4t9UCErv87a9NFKrSLWKtJ",
"allocationAmount": "3194242.558759",
"expected_profit_per_period": 51326.01288742108,
"expected_apr": 0.20946162575868568
},
{
"deploymentID": "QmbHg6vAJRD9ZWz5GTP9oMrfDyetnGTr5KWJBYAq59fm1W",
"allocationAmount": "2446651.541536",
"expected_profit_per_period": 38227.29919168418,
"expected_apr":0.20367434500480655
}
]
}
]
}
Thanks for the suggestion @fordN! This feature is now available as per the docs. https://graphprotocol.github.io/allocation-optimizer/latest/output/
Is your feature request related to a problem? Please describe. The output file from the
optimizesummary
command is difficult to read (human) and parse (machine) as is.Describe the solution you'd like Part of the power of JSON is that the data structures can be self describing, so it doesn't require an ABI to parse it. It supports using objects to define a key for every value. The
optimizesummary
output file does not use thisobject
format to label the values, so the user has to refer to prose in the command output which describes the data structure.It's a bit cumbersome to continually refer to this description in order to read the output JSON file and the separation of the data from the data labeling makes it less clear. For example: it's a bit hard to know what is meant by "Key 0 is as if we repeat the same allocations".
Describe alternatives you've considered Include data labels in the JSON data structure written to local file storage as output of
optimizesummary
command. This will make it human readable, and will actually be better for machine parsing as well (parsing items from JSON using array index values is brittle).