Skip non-Tradovate firms until their trading logic exists
The master's catalog now labels each firm with a platform (TopstepX being the first non-Tradovate one). Sync accepts the field, defaulting anything missing or unrecognized to tradovate so an older master still validates, and getTradableFirms only hands Tradovate firms to the client. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
3ce14d4928
commit
8350601cf0
@@ -104,6 +104,10 @@ export function getCatalogMeta(): {
|
|||||||
export function getTradableFirms(): (CatalogFirm & { username: string; password: string })[] {
|
export function getTradableFirms(): (CatalogFirm & { username: string; password: string })[] {
|
||||||
const result: (CatalogFirm & { username: string; password: string })[] = [];
|
const result: (CatalogFirm & { username: string; password: string })[] = [];
|
||||||
for (const firm of getCachedCatalog()) {
|
for (const firm of getCachedCatalog()) {
|
||||||
|
// Only Tradovate has a client. A TopstepX firm in the catalog is
|
||||||
|
// config-only for now; handing it to the Tradovate login would just
|
||||||
|
// burn attempts against the wrong platform.
|
||||||
|
if (firm.platform !== 'tradovate') continue;
|
||||||
const creds = getCredentials(firm.id);
|
const creds = getCredentials(firm.id);
|
||||||
if (creds) result.push({ ...firm, ...creds });
|
if (creds) result.push({ ...firm, ...creds });
|
||||||
}
|
}
|
||||||
@@ -156,6 +160,10 @@ function validatePayload(raw: unknown): FirmCatalogPayload {
|
|||||||
return {
|
return {
|
||||||
id: firm.id,
|
id: firm.id,
|
||||||
name: firm.name,
|
name: firm.name,
|
||||||
|
// Lenient on purpose: a master from before the platform field (or
|
||||||
|
// with a platform this build doesn't know) must not fail the whole
|
||||||
|
// sync, and 'tradovate' is what every firm was until then.
|
||||||
|
platform: firm.platform === 'topstepx' ? 'topstepx' : 'tradovate',
|
||||||
bannedSymbols: Array.isArray(firm.bannedSymbols) ? (firm.bannedSymbols as string[]) : [],
|
bannedSymbols: Array.isArray(firm.bannedSymbols) ? (firm.bannedSymbols as string[]) : [],
|
||||||
accountTypes,
|
accountTypes,
|
||||||
updatedAt: typeof firm.updatedAt === 'string' ? firm.updatedAt : new Date(0).toISOString(),
|
updatedAt: typeof firm.updatedAt === 'string' ? firm.updatedAt : new Date(0).toISOString(),
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ export interface CatalogAccountType {
|
|||||||
export interface CatalogFirm {
|
export interface CatalogFirm {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
/** Which platform the firm's accounts trade on. Only 'tradovate' firms get
|
||||||
|
* a client here; anything else is synced but sits idle until its trading
|
||||||
|
* logic exists. Older masters omit the field — treated as 'tradovate'. */
|
||||||
|
platform: 'tradovate' | 'topstepx';
|
||||||
bannedSymbols: string[];
|
bannedSymbols: string[];
|
||||||
accountTypes: CatalogAccountType[];
|
accountTypes: CatalogAccountType[];
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user