@tradejs/app 2.0.7 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradejs/app",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "Installable Next.js UI for the TradeJS TypeScript framework: dashboards, backtests, charts, and runtime data.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tradejs",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"@emotion/react": "^11.14.0",
|
|
52
52
|
"@langchain/core": "^1.2.3",
|
|
53
53
|
"@langchain/openai": "^1.5.5",
|
|
54
|
-
"@tradejs/connectors": "^2.0.
|
|
55
|
-
"@tradejs/core": "^2.0.
|
|
56
|
-
"@tradejs/indicators": "^2.0.
|
|
57
|
-
"@tradejs/infra": "^2.0.
|
|
58
|
-
"@tradejs/node": "^2.0.
|
|
59
|
-
"@tradejs/types": "^2.0.
|
|
54
|
+
"@tradejs/connectors": "^2.0.9",
|
|
55
|
+
"@tradejs/core": "^2.0.9",
|
|
56
|
+
"@tradejs/indicators": "^2.0.9",
|
|
57
|
+
"@tradejs/infra": "^2.0.9",
|
|
58
|
+
"@tradejs/node": "^2.0.9",
|
|
59
|
+
"@tradejs/types": "^2.0.9",
|
|
60
60
|
"@types/bcryptjs": "2.4.6",
|
|
61
61
|
"@types/lodash": "4.17.24",
|
|
62
62
|
"@types/node": "24.13.3",
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
} from '@tradejs/infra/redis';
|
|
16
16
|
import type {
|
|
17
17
|
Connector,
|
|
18
|
-
ConnectorCreator,
|
|
19
18
|
RuntimeTradeRecord,
|
|
20
19
|
Interval,
|
|
21
20
|
StrategyConfig,
|
|
@@ -23,6 +22,7 @@ import type {
|
|
|
23
22
|
import { getAvailableStrategyNames } from '@tradejs/node/strategies';
|
|
24
23
|
import {
|
|
25
24
|
DEFAULT_CONNECTOR_PROVIDER,
|
|
25
|
+
resolveConnectorAccountId,
|
|
26
26
|
resolveConnectorCreatorByProvider,
|
|
27
27
|
} from '#app/lib/connectorCreator';
|
|
28
28
|
import { getCurrentUserName } from '#app/lib/currentUser';
|
|
@@ -359,8 +359,15 @@ export const GET = async (request: NextRequest) => {
|
|
|
359
359
|
throw new Error(`No connector available for provider "${provider}"`);
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
const
|
|
362
|
+
const connectorAccountId = await resolveConnectorAccountId({
|
|
363
363
|
userName,
|
|
364
|
+
provider,
|
|
365
|
+
universe: 'crypto',
|
|
366
|
+
});
|
|
367
|
+
const connector = await connectorCreator({
|
|
368
|
+
userName,
|
|
369
|
+
accountId: connectorAccountId,
|
|
370
|
+
universe: 'crypto',
|
|
364
371
|
});
|
|
365
372
|
|
|
366
373
|
const [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Portal, Toast, Toaster, createToaster } from '@chakra-ui/react';
|
|
3
|
+
import { Portal, Stack, Toast, Toaster, createToaster } from '@chakra-ui/react';
|
|
4
4
|
|
|
5
5
|
export const toaster = createToaster({
|
|
6
6
|
placement: 'bottom-end',
|
|
@@ -32,10 +32,12 @@ export const AppToaster = () => {
|
|
|
32
32
|
: 'gray.300'
|
|
33
33
|
}
|
|
34
34
|
/>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
<Stack gap="1" flex="1" minW="0">
|
|
36
|
+
<Toast.Title>{toast.title}</Toast.Title>
|
|
37
|
+
{toast.description ? (
|
|
38
|
+
<Toast.Description>{toast.description}</Toast.Description>
|
|
39
|
+
) : null}
|
|
40
|
+
</Stack>
|
|
39
41
|
<Toast.CloseTrigger />
|
|
40
42
|
</Toast.Root>
|
|
41
43
|
)}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import { getConnectorCreatorByProvider as getBuiltinConnectorCreatorByProvider } from '@tradejs/connectors';
|
|
2
|
+
import { resolveTradingAccount } from '@tradejs/infra/tradingAccounts';
|
|
2
3
|
import { getConnectorCreatorByProvider as getRegisteredConnectorCreatorByProvider } from '@tradejs/node/connectors';
|
|
3
|
-
import { ConnectorCreator } from '@tradejs/types';
|
|
4
|
+
import { ConnectorCreator, MarketUniverse } from '@tradejs/types';
|
|
4
5
|
|
|
5
6
|
export const DEFAULT_CONNECTOR_PROVIDER = 'bybit';
|
|
6
7
|
|
|
8
|
+
export const resolveConnectorAccountId = async ({
|
|
9
|
+
userName,
|
|
10
|
+
provider,
|
|
11
|
+
universe,
|
|
12
|
+
}: {
|
|
13
|
+
userName: string;
|
|
14
|
+
provider: string;
|
|
15
|
+
universe: MarketUniverse;
|
|
16
|
+
}) => {
|
|
17
|
+
const account = await resolveTradingAccount({
|
|
18
|
+
userName,
|
|
19
|
+
provider,
|
|
20
|
+
universe,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return account?.id;
|
|
24
|
+
};
|
|
25
|
+
|
|
7
26
|
export const resolveConnectorCreatorByProvider = async (
|
|
8
27
|
provider: string,
|
|
9
28
|
projectRoot: string,
|
package/src/app/provider.tsx
CHANGED
|
@@ -11,6 +11,40 @@ import { AppToaster, ColorModeProvider } from '#ui';
|
|
|
11
11
|
|
|
12
12
|
const config = defineConfig({
|
|
13
13
|
theme: {
|
|
14
|
+
recipes: {
|
|
15
|
+
button: {
|
|
16
|
+
variants: {
|
|
17
|
+
variant: {
|
|
18
|
+
outline: {
|
|
19
|
+
'--outline-color': 'colors.colorPalette.muted',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
badge: {
|
|
25
|
+
variants: {
|
|
26
|
+
variant: {
|
|
27
|
+
outline: {
|
|
28
|
+
'--outline-shadow': 'colors.colorPalette.muted',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
slotRecipes: {
|
|
35
|
+
tag: {
|
|
36
|
+
slots: defaultConfig.theme?.slotRecipes?.tag?.slots ?? [],
|
|
37
|
+
variants: {
|
|
38
|
+
variant: {
|
|
39
|
+
outline: {
|
|
40
|
+
root: {
|
|
41
|
+
'--outline-shadow': 'colors.colorPalette.muted',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
14
48
|
tokens: {
|
|
15
49
|
cursor: {
|
|
16
50
|
button: { value: 'pointer' },
|