
Security News
Open VSX Begins Implementing Pre-Publish Security Checks After Repeated Supply Chain Incidents
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.
@huskly/schwab-client
Advanced tools
A TypeScript client library for the Schwab Market Data and Trading API.
npm install @huskly/schwab-client
import { SchwabClient } from "@huskly/schwab-client";
const client = new SchwabClient("your-access-token");
const quotes = await client.getQuotes(["AAPL", "GOOGL", "MSFT"]);
console.log(quotes["AAPL"].quote.lastPrice);
// Last 30 days
const history = await client.getPriceHistory({ symbol: "AAPL", days: 30 });
// Custom date range
const history = await client.getPriceHistory({
symbol: "AAPL",
startDate: Date.parse("2024-01-01"),
endDate: Date.now(),
});
const results = await client.searchInstruments("AAPL", "symbol-search");
const movers = await client.getMovers("$SPX", "PERCENT_CHANGE_UP");
console.log(movers.screeners);
const expiries = await client.getAvailableExpiries(
"SPY",
"CALL",
"2025-01-01",
"2025-06-30",
);
const chain = await client.getOptionChain("SPY", new Date("2025-01-17"));
for (const option of chain) {
console.log(
`${option.symbol}: ${option.strike} ${option.isCall ? "C" : "P"} @ ${
option.mid
}`,
);
}
const option = await client.getOptionQuote({
symbol: "SPY",
expiry: new Date("2025-01-17"),
strike: 600,
type: "call",
});
const balances = await client.getAccountBalances();
console.log(`Equity: $${balances.equity}`);
console.log(`Buying Power: $${balances.buyingPower}`);
console.log(`Cash: $${balances.cashBalance}`);
// All positions
const positions = await client.getPositions();
// Filter by symbol
const applePositions = await client.getPositions("AAPL");
const accounts = await client.fetchAccountNumbers();
for (const account of accounts) {
console.log(`Account: ${account.accountNumber}, Hash: ${account.hashValue}`);
}
const history = await client.fetchTransactionHistory(
new Date("2024-01-01"),
new Date(),
);
const prefs = await client.getUserPreference();
console.log(prefs.streamerInfo.streamerSocketUrl);
const orders = await client.fetchOrders({
fromEnteredTime: new Date("2024-01-01"),
toEnteredTime: new Date(),
status: "FILLED", // Optional filter
maxResults: 100, // Optional limit
});
import type { SchwabOrderRequest } from "@huskly/schwab-client";
const order: SchwabOrderRequest = {
session: "NORMAL",
duration: "DAY",
orderType: "LIMIT",
orderStrategyType: "SINGLE",
price: 150.0,
orderLegCollection: [
{
instruction: "BUY",
quantity: 10,
instrument: {
assetType: "EQUITY",
symbol: "AAPL",
},
},
],
};
const accounts = await client.fetchAccountNumbers();
const { orderId } = await client.placeOrder(accounts[0].hashValue, order);
console.log(`Order placed: ${orderId}`);
const rate = await client.getRiskFreeRate(new Date());
// Returns latest 13-week T-bill yield as a decimal (e.g. 0.053 for 5.3%)
const today = client.today();
| Method | Description |
|---|---|
getQuotes(symbols) | Get real-time quotes for multiple symbols |
getPriceHistory(args) | Get historical price data |
getAvailableExpiries(symbol, contractType, fromDate, toDate) | Get available option expiration dates |
getOptionChain(symbol, expiry) | Get full options chain for a symbol and expiry |
getOptionQuote(args) | Get quote for a specific option contract |
searchInstruments(symbol, projection) | Search for instruments |
getMovers(symbolId, sort?, frequency?) | Get top market movers |
| Method | Description |
|---|---|
getAccountEquity() | Get total account equity |
getAccountBalances() | Get detailed account balances |
getPositions(symbol?) | Get account positions |
getPutCreditSpreads(symbol) | Get existing PUT option credit spreads |
fetchAccountNumbers() | Get all linked account numbers |
fetchTransactionHistory(startDate?, endDate?) | Get transaction history |
getUserPreference() | Get user preferences and streaming info |
| Method | Description |
|---|---|
fetchOrders(options) | Get orders across all accounts |
fetchAccountOrders(accountHash, options) | Get orders for specific account |
placeOrder(accountHash, order) | Place a new order |
All types are exported from the package:
import type {
SchwabQuoteResponse,
SchwabOrder,
SchwabOrderRequest,
SchwabPosition,
OptionQuote,
PriceHistoryCandle,
// ... and many more
} from "@huskly/schwab-client";
The client throws errors for failed API requests:
try {
const quotes = await client.getQuotes(["INVALID"]);
} catch (error) {
if (error.message.includes("Unauthorized")) {
// Token expired or invalid
}
}
MIT
FAQs
Schwab Market Data and Trading API client
We found that @huskly/schwab-client demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Security News
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.