question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question Given that the Alpaca API provides dates and numbers as strings, where do you feel the responsibility lies for parsing those values?

Background Right now this package provides types that match the Alpaca API 1:1. For example, in Account, we have buying_power, which is a string. From the developer’s perspective, this is nice because there are no surprises. I can look at the Alpaca Docs and trust that this package will provide me data in the same fashion.

If I want to use buying_power, I need to safely convert it to a number. From a typing perspective, we would ideally have two types: one that matches the Alpaca API and one that has numbers and dates parsed. This package provides the former, but I’m curious about the latter.

Right now I’m basically wrapping your client and doing the mapping myself. For example, I have an AccountParsed type which extends Account and has buying_power_num: number.

Since everyone has to do this, I feel that it should be shared. I would love your feedback this because I’m not sure if it belongs here or in a separate package.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
117commented, Sep 16, 2020

@KalebMills @lbstr I have been testing the github:117/alpaca#dev version on paper for the last two days, haven’t run into any bugs.

2reactions
KalebMillscommented, Sep 16, 2020

Just ran into this issue as well. It seems rather odd that the value return from the Alpaca API for the buying_power property of the account is a string. I’m glad we are handling this in this package. Great job!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parsing Strings with split - cs.wisc.edu
Strings in Java can be parsed using the split method of the String class. ( StringTokenizer can also be used to parse a...
Read more >
String Parsing - objc.io
In almost every computer program, we have to parse strings. Sometimes these strings follow a very simple format, and sometimes they are very...
Read more >
Syntax and Initialization of Java Parse String - eduCBA
Parsing String is the process of getting information that is needed in the String format. String parsing in java can be done by...
Read more >
What is parsing a string? - Quora
Parsing a string is scanning to extract meaning from it, as when a compiler parses a line of source code so that it...
Read more >
How to parse a string in python - Entechin
String parsing is the process of dividing the string into tokens using delimiters to extract the desired information. This tutorial is about How ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found