@arken/seer-protocol 0.1.1 → 0.1.3
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/.rush/temp/shrinkwrap-deps.json +778 -53
- package/area/area.models.ts +15 -0
- package/area/area.router.ts +74 -0
- package/area/area.schema.ts +22 -0
- package/area/area.types.ts +25 -0
- package/area/index.ts +4 -0
- package/asset/asset.models.ts +59 -0
- package/asset/asset.router.ts +55 -0
- package/asset/asset.schema.ts +30 -0
- package/asset/asset.types.ts +21 -0
- package/asset/index.ts +4 -0
- package/chain/chain.models.ts +50 -0
- package/chain/chain.router.ts +104 -0
- package/chain/chain.schema.ts +67 -0
- package/chain/chain.types.ts +23 -0
- package/chain/index.ts +4 -0
- package/character/character.models.ts +174 -0
- package/character/character.router.ts +314 -0
- package/character/character.schema.ts +150 -0
- package/character/character.types.ts +63 -0
- package/character/index.ts +4 -0
- package/chat/chat.models.ts +43 -0
- package/chat/chat.router.ts +67 -0
- package/chat/chat.schema.ts +39 -0
- package/chat/chat.types.ts +19 -0
- package/chat/index.ts +4 -0
- package/collection/collection.models.ts +76 -0
- package/collection/collection.router.ts +91 -0
- package/collection/collection.schema.ts +90 -0
- package/collection/collection.types.ts +35 -0
- package/collection/index.ts +4 -0
- package/core/core.models.ts +1380 -0
- package/core/core.router.ts +1781 -0
- package/core/core.schema.ts +940 -0
- package/core/core.types.ts +339 -0
- package/core/index.ts +4 -0
- package/evolution/evolution.models.ts +1 -1
- package/evolution/evolution.router.ts +19 -19
- package/evolution/evolution.schema.ts +1 -1
- package/evolution/evolution.types.ts +2 -3
- package/evolution/index.ts +0 -1
- package/game/game.models.ts +53 -0
- package/game/game.router.ts +110 -0
- package/game/game.schema.ts +23 -0
- package/game/game.types.ts +27 -0
- package/game/index.ts +4 -0
- package/index.ts +43 -6
- package/infinite/index.ts +0 -1
- package/infinite/infinite.models.ts +1 -1
- package/infinite/infinite.router.ts +9 -9
- package/infinite/infinite.schema.ts +1 -1
- package/infinite/infinite.types.ts +2 -3
- package/interface/index.ts +4 -0
- package/interface/interface.canonicalize.ts +279 -0
- package/interface/interface.models.ts +40 -0
- package/interface/interface.router.ts +175 -0
- package/interface/interface.schema.ts +59 -0
- package/interface/interface.types.ts +24 -0
- package/isles/index.ts +0 -1
- package/isles/isles.models.ts +1 -1
- package/isles/isles.router.ts +9 -9
- package/isles/isles.schema.ts +1 -1
- package/isles/isles.types.ts +2 -3
- package/item/index.ts +4 -0
- package/item/item.models.ts +124 -0
- package/item/item.router.ts +103 -0
- package/item/item.schema.ts +150 -0
- package/item/item.types.ts +73 -0
- package/job/index.ts +4 -0
- package/job/job.models.ts +14 -0
- package/job/job.router.ts +44 -0
- package/job/job.schema.ts +9 -0
- package/job/job.types.ts +22 -0
- package/market/index.ts +4 -0
- package/market/market.models.ts +113 -0
- package/market/market.router.ts +73 -0
- package/market/market.schema.ts +149 -0
- package/market/market.types.ts +55 -0
- package/oasis/index.ts +0 -1
- package/oasis/oasis.models.ts +1 -1
- package/oasis/oasis.router.ts +5 -6
- package/oasis/oasis.schema.ts +1 -1
- package/oasis/oasis.types.ts +2 -3
- package/package.json +17 -4
- package/product/index.ts +4 -0
- package/product/product.models.ts +166 -0
- package/product/product.router.ts +93 -0
- package/product/product.schema.ts +186 -0
- package/product/product.types.ts +32 -0
- package/profile/index.ts +4 -0
- package/profile/profile.models.ts +214 -0
- package/profile/profile.router.ts +72 -0
- package/profile/profile.schema.ts +219 -0
- package/profile/profile.types.ts +21 -0
- package/raffle/index.ts +4 -0
- package/raffle/raffle.models.ts +44 -0
- package/raffle/raffle.router.ts +90 -0
- package/raffle/raffle.schema.ts +32 -0
- package/raffle/raffle.types.ts +29 -0
- package/router.ts +23 -29
- package/schema.ts +321 -0
- package/skill/index.ts +4 -0
- package/skill/skill.models.ts +16 -0
- package/skill/skill.router.ts +201 -0
- package/skill/skill.schema.ts +52 -0
- package/skill/skill.types.ts +32 -0
- package/trek/index.ts +0 -1
- package/trek/trek.models.ts +1 -1
- package/trek/trek.router.ts +2 -2
- package/trek/trek.schema.ts +1 -1
- package/trek/trek.types.ts +1 -1
- package/tsconfig.json +25 -17
- package/types.ts +174 -26
- package/video/index.ts +4 -0
- package/video/video.models.ts +25 -0
- package/video/video.router.ts +143 -0
- package/video/video.schema.ts +46 -0
- package/video/video.types.ts +32 -0
package/job/job.types.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// module/job.types.ts
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import * as schema from './job.schema';
|
|
5
|
+
import { Document, Model } from '@arken/node/mongo';
|
|
6
|
+
import type { RouterContext } from '../types';
|
|
7
|
+
import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
8
|
+
import type { Router } from './job.router';
|
|
9
|
+
|
|
10
|
+
export type * from './job.router';
|
|
11
|
+
export type { RouterContext };
|
|
12
|
+
|
|
13
|
+
export type Job = z.infer<typeof schema.Job>;
|
|
14
|
+
|
|
15
|
+
export type JobDocument = Job & Document;
|
|
16
|
+
|
|
17
|
+
export type Mappings = {
|
|
18
|
+
Job: Model<JobDocument>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type RouterInput = inferRouterInputs<Router>;
|
|
22
|
+
export type RouterOutput = inferRouterOutputs<Router>;
|
package/market/index.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as mongo from '@arken/node/mongo';
|
|
2
|
+
import type * as Types from './market.types';
|
|
3
|
+
|
|
4
|
+
export const Market = mongo.createModel<Types.MarketDocument>('Market', {
|
|
5
|
+
value: { type: String, required: true },
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const MarketPair = mongo.createModel<Types.MarketPairDocument>('MarketPair', {
|
|
9
|
+
value: { type: String, required: true },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const MarketExchange = mongo.createModel<Types.MarketExchangeDocument>('MarketExchange', {
|
|
13
|
+
value: { type: String },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const MarketAnalysis = mongo.createModel<Types.MarketAnalysisDocument>('MarketAnalysis', {
|
|
17
|
+
action: { type: String, required: true },
|
|
18
|
+
asset: { type: String, required: true },
|
|
19
|
+
signalType: { type: String, required: true },
|
|
20
|
+
confidence: { type: Number, required: true },
|
|
21
|
+
riskLevel: { type: String, required: true },
|
|
22
|
+
timeFrame: { type: String, required: true },
|
|
23
|
+
source: { type: String, required: true },
|
|
24
|
+
summary: { type: String, required: true },
|
|
25
|
+
labels: {
|
|
26
|
+
sector: { type: String },
|
|
27
|
+
topic: { type: String },
|
|
28
|
+
sentiment: { type: String },
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const MarketInvestor = mongo.createModel<Types.MarketInvestorDocument>('MarketInvestor', {
|
|
33
|
+
portfolioIds: [{ type: mongo.Schema.Types.ObjectId, required: true }],
|
|
34
|
+
totalPnl: { type: Number },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const MarketInvestmentPortfolio = mongo.createModel<Types.MarketInvestmentPortfolioDocument>(
|
|
38
|
+
'MarketInvestmentPortfolio',
|
|
39
|
+
{
|
|
40
|
+
categoryGoals: [
|
|
41
|
+
{
|
|
42
|
+
category: { type: String, required: true },
|
|
43
|
+
goalPercentage: { type: Number, required: true },
|
|
44
|
+
currentPnL: { type: Number },
|
|
45
|
+
historicalPnL: { type: Number },
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
investmentIds: [{ type: mongo.Schema.Types.ObjectId, required: true }],
|
|
49
|
+
totalPnl: { type: Number },
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export const MarketInvestment = mongo.createModel<Types.MarketInvestmentDocument>('MarketInvestment', {
|
|
54
|
+
type: { type: String, required: true },
|
|
55
|
+
amount: { type: Number, required: true },
|
|
56
|
+
category: { type: String, required: true },
|
|
57
|
+
purchasePrice: { type: Number, required: true },
|
|
58
|
+
currentValue: { type: Number, required: true },
|
|
59
|
+
pnl: { type: Number, required: true },
|
|
60
|
+
transactions: [
|
|
61
|
+
{
|
|
62
|
+
date: { type: Date, required: true },
|
|
63
|
+
type: { type: String, required: true },
|
|
64
|
+
price: { type: Number, required: true },
|
|
65
|
+
quantity: { type: Number, required: true },
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
stockId: { type: mongo.Schema.Types.ObjectId },
|
|
69
|
+
chainTokenId: { type: mongo.Schema.Types.ObjectId },
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const MarketStock = mongo.createModel<Types.MarketStockDocument>('MarketStock', {
|
|
73
|
+
ticker: { type: String, required: true },
|
|
74
|
+
companyId: { type: mongo.Schema.Types.ObjectId, required: true, ref: 'StockCompany' },
|
|
75
|
+
currentPrice: { type: Number, required: true },
|
|
76
|
+
marketCap: { type: Number },
|
|
77
|
+
volume: { type: Number },
|
|
78
|
+
currency: { type: String, required: true },
|
|
79
|
+
aum: { type: Number },
|
|
80
|
+
quoteType: { type: String },
|
|
81
|
+
dailyChange: { type: Number },
|
|
82
|
+
dailyChangePercent: { type: Number },
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const MarketToken = mongo.createModel<Types.MarketTokenDocument>('MarketToken', {
|
|
86
|
+
symbol: { type: String, required: true },
|
|
87
|
+
currentPrice: { type: Number, required: true },
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export const MarketCompany = mongo.createModel<Types.MarketCompanyDocument>('MarketCompany', {
|
|
91
|
+
ticker: { type: String, required: true },
|
|
92
|
+
country: { type: String, required: true },
|
|
93
|
+
industry: { type: String, required: true },
|
|
94
|
+
sector: { type: String, required: true },
|
|
95
|
+
type: { type: String, required: true },
|
|
96
|
+
issuedETFs: [{ type: mongo.Schema.Types.ObjectId, ref: 'MarketETF' }],
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export const MarketETF = mongo.createModel<Types.MarketETFDocument>('ETF', {
|
|
100
|
+
ticker: { type: String, required: true },
|
|
101
|
+
issuerId: { type: mongo.Schema.Types.ObjectId, required: true },
|
|
102
|
+
leverage: { type: Number, required: false },
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const MarketStockSentiment = mongo.createModel<Types.MarketStockSentimentDocument>('MarketStockSentiment', {
|
|
106
|
+
ticker: { type: String, required: true },
|
|
107
|
+
companyId: { type: mongo.Schema.Types.ObjectId, required: true, ref: 'StockCompany' },
|
|
108
|
+
sentiment: {
|
|
109
|
+
label: { type: String, required: true },
|
|
110
|
+
score: { type: Number, required: true },
|
|
111
|
+
},
|
|
112
|
+
confidence: { type: Number, required: true },
|
|
113
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// module/market.router.ts
|
|
2
|
+
|
|
3
|
+
import { z as zod } from 'zod';
|
|
4
|
+
import { initTRPC, inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
5
|
+
import { customErrorFormatter, hasRole } from '@arken/node/rpc';
|
|
6
|
+
import type { RouterContext } from '../types';
|
|
7
|
+
import { Market, MarketPair, MarketExchange } from './market.schema';
|
|
8
|
+
|
|
9
|
+
export const z = zod;
|
|
10
|
+
export const t = initTRPC.context<RouterContext>().create();
|
|
11
|
+
export const router = t.router;
|
|
12
|
+
export const procedure = t.procedure;
|
|
13
|
+
|
|
14
|
+
export const createRouter = () =>
|
|
15
|
+
router({
|
|
16
|
+
getMarket: procedure
|
|
17
|
+
.use(hasRole('guest', t))
|
|
18
|
+
.use(customErrorFormatter(t))
|
|
19
|
+
.input(z.object({ marketId: z.string() }))
|
|
20
|
+
.query(({ input, ctx }) => (ctx.app.service.Market.getMarket as any)(input, ctx)),
|
|
21
|
+
|
|
22
|
+
createMarket: procedure
|
|
23
|
+
.use(hasRole('admin', t))
|
|
24
|
+
.use(customErrorFormatter(t))
|
|
25
|
+
.input(Market)
|
|
26
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Market.createMarket as any)(input, ctx)),
|
|
27
|
+
|
|
28
|
+
updateMarket: procedure
|
|
29
|
+
.use(hasRole('admin', t))
|
|
30
|
+
.use(customErrorFormatter(t))
|
|
31
|
+
.input(z.object({ marketId: z.string(), data: Market.partial() }))
|
|
32
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Market.updateMarket as any)(input, ctx)),
|
|
33
|
+
|
|
34
|
+
getMarketPair: procedure
|
|
35
|
+
.use(hasRole('guest', t))
|
|
36
|
+
.use(customErrorFormatter(t))
|
|
37
|
+
.input(z.object({ marketPairId: z.string() }))
|
|
38
|
+
.query(({ input, ctx }) => (ctx.app.service.Market.getMarketPair as any)(input, ctx)),
|
|
39
|
+
|
|
40
|
+
createMarketPair: procedure
|
|
41
|
+
.use(hasRole('admin', t))
|
|
42
|
+
.use(customErrorFormatter(t))
|
|
43
|
+
.input(MarketPair)
|
|
44
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Market.createMarketPair as any)(input, ctx)),
|
|
45
|
+
|
|
46
|
+
updateMarketPair: procedure
|
|
47
|
+
.use(hasRole('admin', t))
|
|
48
|
+
.use(customErrorFormatter(t))
|
|
49
|
+
.input(z.object({ marketPairId: z.string(), data: MarketPair.partial() }))
|
|
50
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Market.updateMarketPair as any)(input, ctx)),
|
|
51
|
+
|
|
52
|
+
getMarketExchange: procedure
|
|
53
|
+
.use(hasRole('guest', t))
|
|
54
|
+
.use(customErrorFormatter(t))
|
|
55
|
+
.input(z.object({ exchangeId: z.string() }))
|
|
56
|
+
.query(({ input, ctx }) => (ctx.app.service.Market.getMarketExchange as any)(input, ctx)),
|
|
57
|
+
|
|
58
|
+
createMarketExchange: procedure
|
|
59
|
+
.use(hasRole('admin', t))
|
|
60
|
+
.use(customErrorFormatter(t))
|
|
61
|
+
.input(MarketExchange)
|
|
62
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Market.createMarketExchange as any)(input, ctx)),
|
|
63
|
+
|
|
64
|
+
updateMarketExchange: procedure
|
|
65
|
+
.use(hasRole('admin', t))
|
|
66
|
+
.use(customErrorFormatter(t))
|
|
67
|
+
.input(z.object({ exchangeId: z.string(), data: MarketExchange.partial() }))
|
|
68
|
+
.mutation(({ input, ctx }) => (ctx.app.service.Market.updateMarketExchange as any)(input, ctx)),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export type Router = ReturnType<typeof createRouter>;
|
|
72
|
+
export type RouterInput = inferRouterInputs<Router>;
|
|
73
|
+
export type RouterOutput = inferRouterOutputs<Router>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { z, Entity, ObjectId } from '../schema';
|
|
2
|
+
|
|
3
|
+
export const Market = Entity.merge(
|
|
4
|
+
z.object({
|
|
5
|
+
value: z.string(),
|
|
6
|
+
})
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
export const MarketPair = Entity.merge(
|
|
10
|
+
z.object({
|
|
11
|
+
value: z.string(),
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const MarketExchange = Entity.merge(
|
|
16
|
+
z.object({
|
|
17
|
+
value: z.string(),
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const MarketAnalysis = Entity.merge(
|
|
22
|
+
z.object({
|
|
23
|
+
action: z.enum(['Buy', 'Sell']), // buy or sell action
|
|
24
|
+
asset: z.string().min(1), // the asset being traded (e.g., oil, Bitcoin)
|
|
25
|
+
signalType: z.string().min(1), // type of signal (e.g., news)
|
|
26
|
+
confidence: z
|
|
27
|
+
.number()
|
|
28
|
+
.min(0)
|
|
29
|
+
.max(100), // confidence level from 0 to 100
|
|
30
|
+
riskLevel: z.enum(['Low', 'Medium', 'High']), // risk level
|
|
31
|
+
timeFrame: z.enum(['Short-Term', 'Long-Term']), // investment time frame
|
|
32
|
+
source: z.string().min(1), // source of information (e.g., FinancialJuice, Ground News)
|
|
33
|
+
summary: z.string().min(1), // summary of the analysis
|
|
34
|
+
labels: z.object({
|
|
35
|
+
sector: z.string().optional(), // sector related to the asset (e.g., energy, aviation)
|
|
36
|
+
topic: z.string().optional(), // topic of the news (e.g., oil demand, job cuts)
|
|
37
|
+
sentiment: z.enum(['Positive', 'Neutral', 'Negative']).optional(), // sentiment of the news
|
|
38
|
+
}),
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const MarketInvestor = Entity.merge(
|
|
43
|
+
z.object({
|
|
44
|
+
portfolioIds: z.array(ObjectId), // Array of ObjectId references to InvestmentPortfolio
|
|
45
|
+
totalPnl: z.number().optional(), // Total profit and loss
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export const MarketInvestmentPortfolio = Entity.merge(
|
|
50
|
+
z.object({
|
|
51
|
+
categoryGoals: z.array(
|
|
52
|
+
z.object({
|
|
53
|
+
category: z.string(), // Category name
|
|
54
|
+
goalPercentage: z.number(), // Goal percentage for this category
|
|
55
|
+
currentPnl: z.number().optional(), // Current P&L for this category
|
|
56
|
+
historicalPnL: z.number().optional(), // Historical P&L for this category
|
|
57
|
+
})
|
|
58
|
+
), // Array of categories with goal percentages and P&L tracking
|
|
59
|
+
investmentIds: z.array(ObjectId), // Array of ObjectId references to Investment
|
|
60
|
+
totalPnl: z.number().optional(), // Total P&L for this portfolio
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export const MarketInvestment = Entity.merge(
|
|
65
|
+
z.object({
|
|
66
|
+
type: z.enum(['Stock', 'ChainToken']),
|
|
67
|
+
category: z.enum(['Historically Safe', 'Economy Bull', 'Economy Bear', 'Custom']),
|
|
68
|
+
amount: z.number(), // Initial amount invested
|
|
69
|
+
purchasePrice: z.number(), // Price at which the investment was purchased
|
|
70
|
+
currentValue: z.number().optional(), // Current value of the investment
|
|
71
|
+
pnl: z.number().optional(), // Current P&L of the investment
|
|
72
|
+
transactions: z
|
|
73
|
+
.array(
|
|
74
|
+
z.object({
|
|
75
|
+
date: z.string(), // Date of transaction
|
|
76
|
+
type: z.enum(['Buy', 'Sell']),
|
|
77
|
+
price: z.number(), // Price at transaction
|
|
78
|
+
quantity: z.number(), // Quantity bought or sold
|
|
79
|
+
})
|
|
80
|
+
)
|
|
81
|
+
.optional(), // Optional array for detailed transaction history
|
|
82
|
+
stockId: ObjectId.optional(), // Reference to Stock if type is 'Stock'
|
|
83
|
+
chainTokenId: ObjectId.optional(), // Reference to ChainToken if type is 'ChainToken'
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
export const MarketStock = Entity.merge(
|
|
88
|
+
z.object({
|
|
89
|
+
ticker: z.string(),
|
|
90
|
+
companyId: ObjectId,
|
|
91
|
+
marketCap: z.number().optional(),
|
|
92
|
+
aum: z.number().optional(),
|
|
93
|
+
quoteType: z.string(),
|
|
94
|
+
currentPrice: z.number(),
|
|
95
|
+
dailyChange: z.number().optional(),
|
|
96
|
+
dailyChangePercent: z.number().optional(),
|
|
97
|
+
volume: z.number(),
|
|
98
|
+
currency: z.string(),
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
export const MarketToken = Entity.merge(
|
|
103
|
+
z.object({
|
|
104
|
+
symbol: z.string(),
|
|
105
|
+
currentPrice: z.number(),
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
export const MarketCompany = Entity.merge(
|
|
110
|
+
z.object({
|
|
111
|
+
ticker: z.string(), // Primary ticker, if applicable
|
|
112
|
+
type: z.enum(['Public Company', 'ETF Issuer', 'Both', 'Other']), // Categorize the company type
|
|
113
|
+
country: z.string().optional(), // Country where the company is based
|
|
114
|
+
industry: z.string().optional(), // Industry the company operates in
|
|
115
|
+
sector: z.string().optional(), // Sector the company belongs to
|
|
116
|
+
issuedETFs: z.array(ObjectId).optional(), // References to ETFs issued by this company
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export const MarketETF = Entity.merge(
|
|
121
|
+
z.object({
|
|
122
|
+
ticker: z.string(),
|
|
123
|
+
issuerId: ObjectId, // Reference to the Company issuing the ETF
|
|
124
|
+
leverage: z.number().optional(), // Leverage factor if applicable (e.g., 3x)
|
|
125
|
+
country: z.string().optional(), // Country where the ETF is based
|
|
126
|
+
currency: z.string().optional(), // Currency the ETF is traded in
|
|
127
|
+
AUM: z.number().optional(), // Assets under management
|
|
128
|
+
industry: z.string().optional(), // Industry the ETF is focused on
|
|
129
|
+
sector: z.string().optional(), // Sector the ETF is focused on
|
|
130
|
+
})
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
export const MarketStockSentiment = Entity.merge(
|
|
134
|
+
z.object({
|
|
135
|
+
ticker: z.string(),
|
|
136
|
+
companyId: ObjectId,
|
|
137
|
+
sentiment: z.object({
|
|
138
|
+
label: z.enum(['Positive', 'Neutral', 'Negative']), // predefined sentiment labels
|
|
139
|
+
score: z
|
|
140
|
+
.number()
|
|
141
|
+
.min(0)
|
|
142
|
+
.max(1), // sentiment score as a confidence percentage
|
|
143
|
+
}),
|
|
144
|
+
confidence: z
|
|
145
|
+
.number()
|
|
146
|
+
.min(0)
|
|
147
|
+
.max(1), // overall confidence level for the analysis
|
|
148
|
+
})
|
|
149
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// module/market.types.ts
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import * as schema from './market.schema';
|
|
5
|
+
import { Document, Model } from '@arken/node/mongo';
|
|
6
|
+
import type { RouterContext } from '../types';
|
|
7
|
+
import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
8
|
+
import type { Router } from './market.router';
|
|
9
|
+
|
|
10
|
+
export type * from './market.router';
|
|
11
|
+
export type { RouterContext };
|
|
12
|
+
|
|
13
|
+
export type Market = z.infer<typeof schema.Market>;
|
|
14
|
+
export type MarketPair = z.infer<typeof schema.MarketPair>;
|
|
15
|
+
export type MarketExchange = z.infer<typeof schema.MarketExchange>;
|
|
16
|
+
export type MarketAnalysis = z.infer<typeof schema.MarketAnalysis>;
|
|
17
|
+
export type MarketInvestor = z.infer<typeof schema.MarketInvestor>;
|
|
18
|
+
export type MarketInvestmentPortfolio = z.infer<typeof schema.MarketInvestmentPortfolio>;
|
|
19
|
+
export type MarketInvestment = z.infer<typeof schema.MarketInvestment>;
|
|
20
|
+
export type MarketStock = z.infer<typeof schema.MarketStock>;
|
|
21
|
+
export type MarketToken = z.infer<typeof schema.MarketToken>;
|
|
22
|
+
export type MarketCompany = z.infer<typeof schema.MarketCompany>;
|
|
23
|
+
export type MarketETF = z.infer<typeof schema.MarketETF>;
|
|
24
|
+
export type MarketStockSentiment = z.infer<typeof schema.MarketStockSentiment>;
|
|
25
|
+
|
|
26
|
+
export type MarketDocument = Market & Document;
|
|
27
|
+
export type MarketPairDocument = MarketPair & Document;
|
|
28
|
+
export type MarketExchangeDocument = MarketExchange & Document;
|
|
29
|
+
export type MarketAnalysisDocument = MarketAnalysis & Document;
|
|
30
|
+
export type MarketInvestorDocument = MarketInvestor & Document;
|
|
31
|
+
export type MarketInvestmentPortfolioDocument = MarketInvestmentPortfolio & Document;
|
|
32
|
+
export type MarketInvestmentDocument = MarketInvestment & Document;
|
|
33
|
+
export type MarketStockDocument = MarketStock & Document;
|
|
34
|
+
export type MarketTokenDocument = MarketToken & Document;
|
|
35
|
+
export type MarketCompanyDocument = MarketCompany & Document;
|
|
36
|
+
export type MarketETFDocument = MarketETF & Document;
|
|
37
|
+
export type MarketStockSentimentDocument = MarketStockSentiment & Document;
|
|
38
|
+
|
|
39
|
+
export type Mappings = {
|
|
40
|
+
Market: Model<MarketDocument>;
|
|
41
|
+
MarketPair: Model<MarketPairDocument>;
|
|
42
|
+
MarketExchange: Model<MarketExchangeDocument>;
|
|
43
|
+
MarketAnalysis: Model<MarketAnalysisDocument>;
|
|
44
|
+
MarketInvestor: Model<MarketInvestorDocument>;
|
|
45
|
+
MarketInvestmentPortfolio: Model<MarketInvestmentPortfolioDocument>;
|
|
46
|
+
MarketInvestment: Model<MarketInvestmentDocument>;
|
|
47
|
+
MarketStock: Model<MarketStockDocument>;
|
|
48
|
+
MarketToken: Model<MarketTokenDocument>;
|
|
49
|
+
MarketCompany: Model<MarketCompanyDocument>;
|
|
50
|
+
MarketETF: Model<MarketETFDocument>;
|
|
51
|
+
MarketStockSentiment: Model<MarketStockSentimentDocument>;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type RouterInput = inferRouterInputs<Router>;
|
|
55
|
+
export type RouterOutput = inferRouterOutputs<Router>;
|
package/oasis/index.ts
CHANGED
package/oasis/oasis.models.ts
CHANGED
package/oasis/oasis.router.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z as zod } from 'zod';
|
|
2
2
|
import { initTRPC } from '@trpc/server';
|
|
3
|
-
import { customErrorFormatter, hasRole } from '@arken/rpc';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { RouterContext } from '../../types';
|
|
3
|
+
import { customErrorFormatter, hasRole } from '@arken/node/rpc';
|
|
4
|
+
import { Query, getQueryInput, inferRouterOutputs, inferRouterInputs } from '@arken/node/schema';
|
|
5
|
+
import { RouterContext, Core, Profile } from '../types';
|
|
7
6
|
|
|
8
7
|
export const z = zod;
|
|
9
8
|
export const t = initTRPC.context<RouterContext>().create();
|
|
@@ -15,7 +14,7 @@ export const createRouter = () =>
|
|
|
15
14
|
getPatrons: procedure
|
|
16
15
|
.use(hasRole('guest', t))
|
|
17
16
|
.use(customErrorFormatter(t))
|
|
18
|
-
.output(z.array(
|
|
17
|
+
.output(z.array(Profile.Schemas.Profile))
|
|
19
18
|
.query(({ input, ctx }) => (ctx.app.service.Oasis.getPatrons as any)(input, ctx)),
|
|
20
19
|
|
|
21
20
|
interact: t.procedure
|
|
@@ -55,7 +54,7 @@ export const createRouter = () =>
|
|
|
55
54
|
z: 1000,
|
|
56
55
|
},
|
|
57
56
|
},
|
|
58
|
-
] as
|
|
57
|
+
] as Core.Types.Object,
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
60
|
|
package/oasis/oasis.schema.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import { z, ObjectId, Entity } from '@arken/schema';
|
|
1
|
+
import { z, ObjectId, Entity } from '@arken/node/schema';
|
package/oasis/oasis.types.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Model, Document } from '@arken/mongo';
|
|
2
|
+
import { Model, Document } from '@arken/node/mongo';
|
|
3
3
|
import * as schema from './oasis.schema';
|
|
4
4
|
|
|
5
5
|
export type * from './oasis.router';
|
|
6
|
-
export type
|
|
7
|
-
export type { RouterContext } from '../../types';
|
|
6
|
+
export type { RouterContext } from '../types';
|
|
8
7
|
|
|
9
8
|
// // Define types based on the schema
|
|
10
9
|
// export type Game = z.infer<typeof schema.Game>;
|
package/package.json
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arken/seer-protocol",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"main": "
|
|
5
|
-
"scripts": {
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"main": "index.ts",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm-run-all dist",
|
|
7
|
+
"clean": "del-cli ./build && make-dir ./build",
|
|
8
|
+
"dist": "npm-run-all clean tsc:*",
|
|
9
|
+
"publish": "npm publish --access=public",
|
|
10
|
+
"tsc:1": "rm -rf ./build && mkdir ./build && cp package.json ./build && NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 tsc --listFiles"
|
|
11
|
+
},
|
|
6
12
|
"dependencies": {
|
|
13
|
+
"@arken/node": "^1.5.3",
|
|
7
14
|
"@arken/forge-protocol": "^0.1.1",
|
|
8
15
|
"@trpc/client": "11.0.0-rc.660",
|
|
9
16
|
"@trpc/server": "11.0.0-rc.660",
|
|
17
|
+
"make-dir-cli": "^3",
|
|
18
|
+
"jest": "^29",
|
|
19
|
+
"@types/jest": "^29",
|
|
20
|
+
"@types/node": "^20",
|
|
10
21
|
"zod": "^3",
|
|
11
22
|
"dotenv": "^16",
|
|
12
23
|
"lodash": "^4",
|
|
13
24
|
"dayjs": "^1"
|
|
14
25
|
},
|
|
15
|
-
"devDependencies": {
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"del-cli": "^5"
|
|
28
|
+
}
|
|
16
29
|
}
|
package/product/index.ts
ADDED