A more streamlined API.
See original GitHub issueClient.getAsset(), Client.getAssets(), Client.getWatchlist(), Client.createWatchlist(), etc. seems like a really outdated way to do a modern API. I would suggest an Client.assets
property that has an assets cache and the required methods built-in like this:
Client.assets.get(parameters?: GetAssetsParameters): Promise<Asset|Asset[]> {
return this.request(method.GET, BaseURL.Account, parameters.asset_id_or_symbol ? "assets/" + parameters.asset_id_or_symbol : "assets?" + qs.stringify(parameters));
}
which gets all assets without parameters and specific assets using given parameters otherwise. This can be done with watchlists, account configurations, clocks, calendars, and many other methods/objects.
Issue Analytics
- State:
- Created 3 years ago
- Comments:29 (21 by maintainers)
Top Results From Across the Web
How to Use APIs to Streamline Processes and Increase ...
Here are a few examples of how businesses can use APIs to streamline processes. DreamFactory Hosted Trial Signup. Generate a full-featured, ...
Read more >6 Ways APIs Can Streamline Your Business
One way businesses are using APIs is to open up new forms of monetization. There are multiple ways to do so. For instance,...
Read more >What Is an API and How Can I Streamline Operations ...
Learn what an API is and how to streamline your operations by using one. ... The term API is an acronym for application...
Read more >Streamlined API Management for Developers - Himasha Guruge
In an ideal world, API management should be more aligned with the usual developer and ops workflow of an organization.
Read more >How APIs integrate and streamline your digital ecosystem
Adopting an Application Programming Interface (API) integration is a stress-free approach to streamlining an organization's digital ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m too lazy so can you just commit this yourself? Here is a completely redone README.md. You have the code, so you can revise and change whatever you want before committing too:
alpaca-trade-api-ts
A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.
Table of Contents:
alpaca.Client
Client
Initializationalpaca.Stream
InitializationInstallation
alpaca.Client
A client for handling all account based requests.
Client
InitializationThe standard way to initialize
You can also use environment variables which will be applied to every new client.
Due to the asynchronous nature of the client we recommended you listen for interrupts.
Methods
All Client instance methods.
isAuthenticated
Checks if the client is authenticated.
getAccount
Connects to an Alpaca account.
getOrder
Gets a specific order.
getOrders
Gets all orders made by the client.
placeOrder
Places an order using your account.
replaceOrder
Re-places an order(to change some details maybe).
cancelOrder
Cancels an order.
cancelOrders
Cancels every single order(be sure to not make a typo here!)
Stream
An Alpaca websocket API for streamlining the exchange of requests and data to and from the Alpaca servers.
alpaca.Stream
InitializationAn API key is allowed 1 simultaneous connection to each server. Connecting to them is easy:
BaseURL
Contains 2 properties used for securing a connection to an Alpaca websocket:
wss://api.alpaca.markets/stream
BaseURL.AccountStream
wss://data.alpaca.markets/stream
BaseURL.MarketDataStream
Contribute
Pull requests are encouraged. 😁
Also, after learning JavaScript and mainly TypeScript practices, I can never look at Java code without frustration or disgust anymore.