feat(research): compare immutable fee and slippage scenarios
This commit is contained in:
parent
3ed7b98f7c
commit
397cd0e160
41 changed files with 3234 additions and 144 deletions
|
|
@ -4,6 +4,10 @@ import { getCredentialHttpPrincipal } from '@stock-bot/di';
|
|||
import { getLogger } from '@stock-bot/logger';
|
||||
import type { IServiceContainer } from '@stock-bot/services';
|
||||
import { ChronologicalValidationService } from '../services/chronological-validation.service';
|
||||
import {
|
||||
parseCostSensitivityInput,
|
||||
parseCostSensitivitySubmission,
|
||||
} from '../services/cost-sensitivity-input';
|
||||
import {
|
||||
ExperimentError,
|
||||
experimentId,
|
||||
|
|
@ -57,6 +61,23 @@ export function createExperimentRoutes(container: IServiceContainer) {
|
|||
throw new ExperimentError(400, 'Invalid JSON request');
|
||||
}
|
||||
};
|
||||
app.post('/api/v2/experiments/cost-sensitivity/preview', async c =>
|
||||
c.json({
|
||||
preview: await service.previewCosts(parseCostSensitivityInput(await body(c.req.raw))),
|
||||
})
|
||||
);
|
||||
app.post('/api/v2/experiments/cost-sensitivity', async c => {
|
||||
const input = parseCostSensitivitySubmission(await body(c.req.raw));
|
||||
const experiment = await service.submitCosts(
|
||||
input,
|
||||
experimentReceipt({
|
||||
principal: getCredentialHttpPrincipal(c.req.raw) ?? '',
|
||||
key: c.req.header('Idempotency-Key') ?? '',
|
||||
})
|
||||
);
|
||||
c.header('Location', `/api/v2/experiments/${experiment.id}`);
|
||||
return c.json({ experiment }, 202);
|
||||
});
|
||||
app.post('/api/v2/experiments/walk-forward/preview', async c =>
|
||||
c.json({ preview: await walkForwards.preview(parseWalkForwardInput(await body(c.req.raw))) })
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue