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

Toolkit should simplify nested types #55

Open
aesedepece opened this issue Mar 1, 2022 · 0 comments
Open

Toolkit should simplify nested types #55

aesedepece opened this issue Mar 1, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@aesedepece
Copy link
Member

The toolkit wrapper currently simplifies Radon types such as RadonArray → Array, but only for simple types, not in nested structures.

For example, look at the types inside maps in this execution report:

╔════════════════════════════════════════════╗
║ Witnet data request local execution report ║
╚╤═══════════════════════════════════════════╝
 │
 │  ┌────────────────────────────────────────────────┐
 ├──┤ Retrieval stage                                │
 │  ├────────────────────────────────────────────────┤
 │  │ Number of retrieved data sources: 4            │
 │  └┬───────────────────────────────────────────────┘
 │   │
 │   ├─[ Source #0 (api.binance.us) ]
 |   │  Method: HTTP-GET
 |   │  Complete URL: https://api.binance.us/api/v3/ticker/price?symbol=USDCUSD
 |   │  Number of executed operators: 4
 |   │  Execution time: 0.02007 ms
 |   │  Execution trace:
 │   │    [0] HTTP-GET -> String: "{\"symbol\":\"USDCUSD\",\"price\":\"0.9999\"}"
 │   │    [1] .parseJSONMap() -> Map: {"price":{"RadonString":"0.9999"},"symbol":{"RadonString":"USDCUSD"}}
 │   │    [2] .getFloat(price) -> Float: 0.9999
 │   │    [3] .multiply(1000000) -> Float: 999900
 │   │    [4] .round() -> Integer: 999900
 |   │  Result: Integer: 999900
 |   │
 │   ├─[ Source #1 (www.bitstamp.net) ]
 |   │  Method: HTTP-GET
 |   │  Complete URL: https://www.bitstamp.net/api/v2/ticker/usdcusd
 |   │  Number of executed operators: 4
 |   │  Execution time: 0.03022 ms
 |   │  Execution trace:
 │   │    [0] HTTP-GET -> String: "{\"high\": \"1.00203\", \"last\": \"0.99962\", \"timestamp\": \"1646140864\", \"bid\": \"0.99962\", \"vwap\": \"0.99878\", \"volume\": \"1494770.88851\", \"low\": \"0.99558\", \"ask\": \"0.99999\", \"open\": \"1.00023\"}"
 │   │    [1] .parseJSONMap() -> Map: {"ask":{"RadonString":"0.99999"},"bid":{"RadonString":"0.99962"},"high":{"RadonString":"1.00203"},"last":{"RadonString":"0.99962"},"low":{"RadonString":"0.99558"},"open":{"RadonString":"1.00023"},"timestamp":{"RadonString":"1646140864"},"volume":{"RadonString":"1494770.88851"},"vwap":{"RadonString":"0.99878"}}
 │   │    [2] .getFloat(last) -> Float: 0.99962
 │   │    [3] .multiply(1000000) -> Float: 999620
 │   │    [4] .round() -> Integer: 999620
 |   │  Result: Integer: 999620
 |   │
 │   ├─[ Source #2 (api.bittrex.com) ]
 |   │  Method: HTTP-GET
 |   │  Complete URL: https://api.bittrex.com/v3/markets/USDC-USD/ticker
 |   │  Number of executed operators: 4
 |   │  Execution time: 0.02832 ms
 |   │  Execution trace:
 │   │    [0] HTTP-GET -> String: "{\"symbol\":\"USDC-USD\",\"lastTradeRate\":\"1.00000000\",\"bidRate\":\"0.99990000\",\"askRate\":\"0.99999000\"}"
 │   │    [1] .parseJSONMap() -> Map: {"askRate":{"RadonString":"0.99999000"},"bidRate":{"RadonString":"0.99990000"},"lastTradeRate":{"RadonString":"1.00000000"},"symbol":{"RadonString":"USDC-USD"}}
 │   │    [2] .getFloat(lastTradeRate) -> Float: 1
 │   │    [3] .multiply(1000000) -> Float: 1000000
 │   │    [4] .round() -> Integer: 1000000
 |   │  Result: Integer: 1000000
 |   │
 │   └─[ Source #3 (api.kraken.com) ]
 |      Method: HTTP-GET
 |      Complete URL: https://api.kraken.com/0/public/Ticker?pair=USDCUSD
 |      Number of executed operators: 7
 |      Execution time: 0.100541 ms
 |      Execution trace:
 │        [0] HTTP-GET -> String: "{\"error\":[],\"result\":{\"USDCUSD\":{\"a\":[\"1.00010000\",\"5934071\",\"5934071.000\"],\"b\":[\"1.00000000\",\"236\",\"236.000\"],\"c\":[\"1.00000000\",\"64.16094880\"],\"v\":[\"9435183.06631663\",\"21557056.61070495\"],\"p\":[\"0.99995380\",\"0.99996195\"],\"t\":[4033,7216],\"l\":[\"0.99990000\",\"0.99990000\"],\"h\":[\"1.00010000\",\"1.00010000\"],\"o\":\"1.00000000\"}}}"
 │        [1] .parseJSONMap() -> Map: {"error":{"RadonArray":[]},"result":{"RadonMap":{"USDCUSD":{"RadonMap":{"a":{"RadonArray":[{"RadonString":"1.00010000"},{"RadonString":"5934071"},{"RadonString":"5934071.000"}]},"b":{"RadonArray":[{"RadonString":"1.00000000"},{"RadonString":"236"},{"RadonString":"236.000"}]},"c":{"RadonArray":[{"RadonString":"1.00000000"},{"RadonString":"64.16094880"}]},"h":{"RadonArray":[{"RadonString":"1.00010000"},{"RadonString":"1.00010000"}]},"l":{"RadonArray":[{"RadonString":"0.99990000"},{"RadonString":"0.99990000"}]},"o":{"RadonString":"1.00000000"},"p":{"RadonArray":[{"RadonString":"0.99995380"},{"RadonString":"0.99996195"}]},"t":{"RadonArray":[{"RadonInteger":"4033"},{"RadonInteger":"7216"}]},"v":{"RadonArray":[{"RadonString":"9435183.06631663"},{"RadonString":"21557056.61070495"}]}}}}}}
 │        [2] .getMap(result) -> Map: {"USDCUSD":{"RadonMap":{"a":{"RadonArray":[{"RadonString":"1.00010000"},{"RadonString":"5934071"},{"RadonString":"5934071.000"}]},"b":{"RadonArray":[{"RadonString":"1.00000000"},{"RadonString":"236"},{"RadonString":"236.000"}]},"c":{"RadonArray":[{"RadonString":"1.00000000"},{"RadonString":"64.16094880"}]},"h":{"RadonArray":[{"RadonString":"1.00010000"},{"RadonString":"1.00010000"}]},"l":{"RadonArray":[{"RadonString":"0.99990000"},{"RadonString":"0.99990000"}]},"o":{"RadonString":"1.00000000"},"p":{"RadonArray":[{"RadonString":"0.99995380"},{"RadonString":"0.99996195"}]},"t":{"RadonArray":[{"RadonInteger":"4033"},{"RadonInteger":"7216"}]},"v":{"RadonArray":[{"RadonString":"9435183.06631663"},{"RadonString":"21557056.61070495"}]}}}}
 │        [3] .getMap(USDCUSD) -> Map: {"a":{"RadonArray":[{"RadonString":"1.00010000"},{"RadonString":"5934071"},{"RadonString":"5934071.000"}]},"b":{"RadonArray":[{"RadonString":"1.00000000"},{"RadonString":"236"},{"RadonString":"236.000"}]},"c":{"RadonArray":[{"RadonString":"1.00000000"},{"RadonString":"64.16094880"}]},"h":{"RadonArray":[{"RadonString":"1.00010000"},{"RadonString":"1.00010000"}]},"l":{"RadonArray":[{"RadonString":"0.99990000"},{"RadonString":"0.99990000"}]},"o":{"RadonString":"1.00000000"},"p":{"RadonArray":[{"RadonString":"0.99995380"},{"RadonString":"0.99996195"}]},"t":{"RadonArray":[{"RadonInteger":"4033"},{"RadonInteger":"7216"}]},"v":{"RadonArray":[{"RadonString":"9435183.06631663"},{"RadonString":"21557056.61070495"}]}}
 │        [4] .getArray(a) -> Array: [{"RadonString":"1.00010000"},{"RadonString":"5934071"},{"RadonString":"5934071.000"}]
 │        [5] .getInteger(0) -> Float: 1.0001
 │        [6] .multiply(1000000) -> Float: 1000100
 │        [7] .round() -> Integer: 1000100
 |      Result: Integer: 1000100
 │
 │  ┌────────────────────────────────────────────────┐
 ├──┤ Aggregation stage                              │
 │  ├────────────────────────────────────────────────┤
 │  │ Execution time: 0.00615 ms                     │
 │  │ Result is Integer: 1000000                     │
 │  └────────────────────────────────────────────────┘
 │  
 │  ┌────────────────────────────────────────────────┐
 └──┤ Tally stage                                    │
    ├────────────────────────────────────────────────┤
    │ Execution time: 0.00148 ms                     │
    │ Result is Integer: 1000000                     │
    └────────────────────────────────────────────────┘
@aesedepece aesedepece added the enhancement New feature or request label Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant