Crypto trading bot: engine, brokers, backtester, dashboard, deploy
FastAPI backend with a single-strategy async engine, paper and Binance brokers, pure-python indicators, a backtester that shares the engine's portfolio math, and a Vue dashboard with a live WebSocket feed. Adds the Gitea Actions CI/CD workflow that deploys to Traefik via docker_default.
This commit is contained in:
1 parent
98028248c2
commit
9c3bee87ac
73 files changed
+9759
-1
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { fmtMoney, fmtPrice, pnlClass, signed } from './format'
|
||||
|
||||
describe('format helpers', () => {
|
||||
it('formats money with two decimals', () => {
|
||||
expect(fmtMoney(10000)).toBe('10,000.00')
|
||||
})
|
||||
|
||||
it('handles null', () => {
|
||||
expect(fmtMoney(null)).toBe('—')
|
||||
expect(fmtPrice(undefined)).toBe('—')
|
||||
})
|
||||
|
||||
it('formats small prices with six decimals', () => {
|
||||
expect(fmtPrice(0.5)).toBe('0.500000')
|
||||
})
|
||||
|
||||
it('signs positive values', () => {
|
||||
expect(signed(12.346)).toBe('+12.35')
|
||||
expect(signed(-3)).toBe('-3.00')
|
||||
})
|
||||
|
||||
it('classifies pnl colour', () => {
|
||||
expect(pnlClass(5)).toBe('text-emerald-400')
|
||||
expect(pnlClass(-5)).toBe('text-rose-400')
|
||||
expect(pnlClass(0)).toBe('text-slate-300')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user