Title: Minor bug in CryptoTrade class not showing symbol · Issue #164 · massive-com/client-python · GitHub
Open Graph Title: Minor bug in CryptoTrade class not showing symbol · Issue #164 · massive-com/client-python
X Title: Minor bug in CryptoTrade class not showing symbol · Issue #164 · massive-com/client-python
Description: Original code @dataclass class CryptoTrade: "CryptoTrade contains trade data for a crypto pair." event_type: Optional[Union[str, EventType]] = None symbol: Optional[str] = None exchange: Optional[int] = None id: Optional[str] = None pric...
Open Graph Description: Original code @dataclass class CryptoTrade: "CryptoTrade contains trade data for a crypto pair." event_type: Optional[Union[str, EventType]] = None symbol: Optional[str] = None exchange: Optional[i...
X Description: Original code @dataclass class CryptoTrade: "CryptoTrade contains trade data for a crypto pair." event_type: Optional[Union[str, EventType]] = None symbol: Optional[str] = None exchange: ...
Opengraph URL: https://github.com/massive-com/client-python/issues/164
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Minor bug in CryptoTrade class not showing symbol","articleBody":"Original code\r\n```\r\n@dataclass\r\nclass CryptoTrade:\r\n \"CryptoTrade contains trade data for a crypto pair.\"\r\n event_type: Optional[Union[str, EventType]] = None\r\n symbol: Optional[str] = None\r\n exchange: Optional[int] = None\r\n id: Optional[str] = None\r\n price: Optional[float] = None\r\n size: Optional[float] = None\r\n conditions: Optional[List[int]] = None\r\n timestamp: Optional[int] = None\r\n received_timestamp: Optional[int] = None\r\n\r\n @staticmethod\r\n def from_dict(d):\r\n return CryptoTrade(\r\n d.get(\"ev\", None),\r\n d.get(\"sym\", None),\r\n d.get(\"x\", None),\r\n d.get(\"i\", None),\r\n d.get(\"p\", None),\r\n d.get(\"s\", None),\r\n d.get(\"c\", None),\r\n d.get(\"t\", None),\r\n d.get(\"r\", None),\r\n )\r\n```\r\nProduces the following output\r\n```\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292583', price=2668.09, size=0.001, conditions=[1], timestamp=1651897896019, received_timestamp=1651897896029)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292584', price=2668.09, size=0.00346924, conditions=[1], timestamp=1651897896019, received_timestamp=1651897896029), CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292585', price=2668.1, size=0.02227499, conditions=[1], timestamp=1651897896019, received_timestamp=1651897029), CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292587', price=2668.11, size=0.02726552, conditions=[1], timestamp=1651897896019, received_timestamp=1651897896029), CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292588', price=2668.11, size=0.04693849, conditions=[1], timestamp=1651897896019, received_timestamp=1651897896029), \r\nCryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292589', price=2668.43, size=0.798, conditions=[1], timestamp=1651897896019, received_timestamp=1651897896029)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292590', price=2668.5, size=0.001, conditions=[1], timestamp=1651897897236, received_timestamp=1651897897245)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292591', price=2668.5, size=0.001, conditions=[1], timestamp=1651897897236, received_timestamp=1651897897245), CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292592', price=2668.5, size=0.00173462, conditions=[1], timestamp=1651897897236, received_timestamp=1651897897245), CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292593', price=2668.63, size=0.02728372, conditions=[1], timestamp=1651897897236, received_timestamp=1651897897245), \r\nCryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292594', price=2668.66, size=0.22281884, conditions=[1], timestamp=1651897897236, received_timestamp=1651897897245)] \r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292595', price=2668.54, size=0.001, conditions=[1], timestamp=1651897898157, received_timestamp=1651897898165)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292596', price=2668.54, size=0.001, conditions=[1], timestamp=1651897898157, received_timestamp=1651897898165), CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292597', price=2668.54, size=0.00086731, conditions=[1], timestamp=1651897898157, received_timestamp=1651897898165), CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292598', price=2668.54, size=0.00434975, conditions=[1], timestamp=1651897898157, received_timestamp=1651897898165)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292599', price=2668.53, size=0.001, conditions=[2], timestamp=1651897898476, received_timestamp=1651897898484)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292600', price=2668.53, size=0.001, conditions=[2], timestamp=1651897898476, received_timestamp=1651897898485), CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292601', price=2668.53, size=0.001, conditions=[2], timestamp=1651897898476, received_timestamp=1651897898485), \r\nCryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292602', price=2668.53, size=0.001, conditions=[2], timestamp=1651897898476, received_timestamp=1651897898485)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=2, id='1085319591', price=35906, size=0.00011582, conditions=[1], timestamp=1651897898715, received_timestamp=1651897898770)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=2, id='1085319591', price=35906, size=0.00011582, conditions=[1], timestamp=1651897898715, received_timestamp=1651897898831)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='327314603', price=35865.06, size=0.00277459, conditions=[1], timestamp=1651897898938, received_timestamp=1651897898949)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=23, id='9a80e301-cb88-4bbe-b7cf-3e413d7f3714', price=2665.99, size=0.10262799, conditions=[2], timestamp=1651897898915, received_timestamp=1651897898962)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=1, id='268292603', price=2668.51, size=0.19709093, conditions=[1], timestamp=1651897899222, received_timestamp=1651897899230)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol=None, exchange=23, id='943715f5-6603-4e55-b541-be84cc8e1f19', price=2666.42, size=0.04301937, conditions=[2], timestamp=1651897899482, received_timestamp=1651897899529)]\r\n```\r\n\r\nshould change ```d.get(\"sym\", None)``` to ``` d.get(\"pair\", None)```\r\n```\r\n@dataclass\r\nclass CryptoTrade:\r\n \"CryptoTrade contains trade data for a crypto pair.\"\r\n event_type: Optional[Union[str, EventType]] = None\r\n symbol: Optional[str] = None\r\n exchange: Optional[int] = None\r\n id: Optional[str] = None\r\n price: Optional[float] = None\r\n size: Optional[float] = None\r\n conditions: Optional[List[int]] = None\r\n timestamp: Optional[int] = None\r\n received_timestamp: Optional[int] = None\r\n\r\n @staticmethod\r\n def from_dict(d):\r\n return CryptoTrade(\r\n d.get(\"ev\", None),\r\n d.get(\"pair\", None),\r\n d.get(\"x\", None),\r\n d.get(\"i\", None),\r\n d.get(\"p\", None),\r\n d.get(\"s\", None),\r\n d.get(\"c\", None),\r\n d.get(\"t\", None),\r\n d.get(\"r\", None),\r\n )\r\n```\r\n\r\nNow output is okay\r\n```\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='BTC-USD', exchange=1, id='327315546', price=35803.34, size=0.00058953, conditions=[2], timestamp=1651898146638, received_timestamp=1651898146647)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='BTC-USD', exchange=1, id='327315547', price=35804.81, size=0.001, conditions=[1], timestamp=1651898146642, received_timestamp=1651898146652)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='BTC-USD', exchange=1, id='327315548', price=35804.82, size=0.00169632, conditions=[1], timestamp=1651898146642, received_timestamp=1651898146652)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='BTC-USD', exchange=1, id='327315549', price=35804.81, size=0.01368515, conditions=[1], timestamp=1651898147259, received_timestamp=1651898147268)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='BTC-USD', exchange=1, id='327315550', price=35803.81, size=2.358e-05, conditions=[2], timestamp=1651898147312, received_timestamp=1651898147320)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='ETH-USD', exchange=1, id='268293802', price=2663.29, size=0.001, conditions=[1], timestamp=1651898148429, received_timestamp=1651898148437)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='ETH-USD', exchange=1, id='268293803', price=2663.35, size=0.02727959, conditions=[2], timestamp=1651898148472, received_timestamp=1651898148480)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='BTC-USD', exchange=1, id='327315551', price=35805.95, size=0.00065328, conditions=[1], timestamp=1651898148604, received_timestamp=1651898148612)]\r\n\u003cclass 'list'\u003e [CryptoTrade(event_type='XT', symbol='BTC-USD', exchange=1, id='327315552', price=35805.95, size=0.00025053, conditions=[1], timestamp=1651898148808, received_timestamp=1651898148818)]\r\n```","author":{"url":"https://github.com/dobizz","@type":"Person","name":"dobizz"},"datePublished":"2022-05-07T04:43:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/164/client-python/issues/164"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4ddb61ad-f788-10ef-745a-e3502e9d50c3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D3C4:B6221:BED450:111EB23:6A4E4903 |
| html-safe-nonce | 968f46347676ffa51f47e4be7213dd08815a03f499d2447be86c2edca5686202 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0M0OkI2MjIxOkJFRDQ1MDoxMTFFQjIzOjZBNEU0OTAzIiwidmlzaXRvcl9pZCI6Ijg1NzgyOTc1OTAzNDg0MDA4OTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0c8d4f20d732eeef261ba739b3a471edb8b7d57ba19f356e020b7825e5a923de |
| hovercard-subject-tag | issue:1228525308 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/massive-com/client-python/164/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6b2f5516982117ba23ab744bde7d79a853b4315ca20bb31c605c5ec86fe313ef/massive-com/client-python/issues/164 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6b2f5516982117ba23ab744bde7d79a853b4315ca20bb31c605c5ec86fe313ef/massive-com/client-python/issues/164 |
| og:image:alt | Original code @dataclass class CryptoTrade: "CryptoTrade contains trade data for a crypto pair." event_type: Optional[Union[str, EventType]] = None symbol: Optional[str] = None exchange: Optional[i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dobizz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/massive-com/client-python git https://github.com/massive-com/client-python.git |
| octolytics-dimension-user_id | 191946194 |
| octolytics-dimension-user_login | massive-com |
| octolytics-dimension-repository_id | 216660192 |
| octolytics-dimension-repository_nwo | massive-com/client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 216660192 |
| octolytics-dimension-repository_network_root_nwo | massive-com/client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e8506f6d0538364886e3f0153c154c410965e70d |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width