Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@master-chief/alpaca
Advanced tools
A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.
A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.
> npm i @master-chief/alpaca
A client for handling all account based requests.
The standard way to initialize the client.
import * as alpaca from '@master-chief/alpaca'
// create the client
const client = new alpaca.Client({
credentials: {
key: 'mykey',
secret: 'mysecret',
},
paper: true,
rate_limit: true,
})
You can also use environment variables which will be applied to every new client.
> set APCA_API_KEY_ID=yourKeyGoesHere
> set APCA_API_SECRET_KEY=yourKeyGoesHere
> set APCA_PAPER=true
All Client instance methods.
Checks if the client is authenticated.
await client.isAuthenticated()
Connects to an Alpaca account.
await client.getAccount()
Gets a specific order.
await client.getOrder({
order_id: '6187635d-04e5-485b-8a94-7ce398b2b81c',
})
Gets all orders made by the client.
await client.getOrders({
limit: 25,
status: 'all',
})
Places an order using your account.
await client.placeOrder({
symbol: 'SPY',
qty: 1,
side: 'buy',
type: 'market',
time_in_force: 'day',
})
Re-places an order(to change some details maybe).
await client.replaceOrder({
order_id: '69a3db8b-cc63-44da-a26a-e3cca9490308',
limit_price: 9.74,
})
Cancels an order.
await client.cancelOrder({
order_id: '69a3db8b-cc63-44da-a26a-e3cca9490308',
})
Cancels every single order(be sure to not make a typo here!)
await client.cancelOrders()
More examples are coming soon... give me some time or feel free to contribute.
An Alpaca websocket API for streamlining the exchange of requests and data to and from the Alpaca servers.
An API key is allowed 1 simultaneous connection to each server. Connecting to them is easy:
import * as alpaca from '@master-chief/alpaca'
// create the stream
const stream = new alpaca.Stream({
credentials: {
key: 'mykey',
secret: 'mysecret',
},
host: alpaca.URL.WSS_MARKET_DATA,
})
// subscribe once authenticated with the server
stream.on('authenticated', () => stream.subscribe(['AM.SPY']))
// listen for new aggregates
stream.on('aggregate_minute', (aggregate) => {
console.log(aggregate)
})
Pull requests are encouraged. 😁
FAQs
A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.
The npm package @master-chief/alpaca receives a total of 113 weekly downloads. As such, @master-chief/alpaca popularity was classified as not popular.
We found that @master-chief/alpaca demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.