Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions apps/sim/tools/kalshi/get_balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export interface KalshiGetBalanceResponse {
success: boolean
output: {
balance: number // In cents
portfolioValue?: number // In cents
balanceDollars: number // Converted to dollars
portfolioValueDollars?: number // Converted to dollars
portfolioValue: number // In cents
}
}

Expand Down Expand Up @@ -51,24 +49,20 @@ export const kalshiGetBalanceTool: ToolConfig<KalshiGetBalanceParams, KalshiGetB
handleKalshiError(data, response.status, 'get_balance')
}

const balance = data.balance || 0
const portfolioValue = data.portfolio_value
const balance = data.balance ?? 0
const portfolioValue = data.portfolio_value ?? 0

return {
success: true,
output: {
balance,
portfolioValue,
balanceDollars: balance / 100,
portfolioValueDollars: portfolioValue ? portfolioValue / 100 : undefined,
},
}
},

outputs: {
balance: { type: 'number', description: 'Account balance in cents' },
portfolioValue: { type: 'number', description: 'Portfolio value in cents' },
balanceDollars: { type: 'number', description: 'Account balance in dollars' },
portfolioValueDollars: { type: 'number', description: 'Portfolio value in dollars' },
},
}