Skip to content

Commit 7a32524

Browse files
committed
Technical Indicator API components & constants file
1 parent d508bb8 commit 7a32524

File tree

14 files changed

+738
-89
lines changed

14 files changed

+738
-89
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import mboum from "../../mboum.app.mjs";
2+
3+
export default {
4+
key: "mboum-get-ad",
5+
name: "Get Accumulation/Distribution Line (AD)",
6+
description: "Calculate Accumulation/Distribution Line technical indicator to measure volume flow and confirm price trends. [See the documentation](https://docs.mboum.com/#stocks-options-small-stylecolor-f8f2f2background-fa256fpadding-1px-4pxborder-radius-3pxhotsmall-GETapi-v1-markets-indicators-ad)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mboum,
11+
ticker: {
12+
propDefinition: [
13+
mboum,
14+
"ticker",
15+
],
16+
},
17+
interval: {
18+
propDefinition: [
19+
mboum,
20+
"interval",
21+
],
22+
},
23+
limit: {
24+
propDefinition: [
25+
mboum,
26+
"limit",
27+
],
28+
},
29+
},
30+
async run({ $ }) {
31+
const response = await this.mboum.getAD({
32+
$,
33+
params: {
34+
ticker: this.ticker,
35+
interval: this.interval,
36+
limit: this.limit,
37+
},
38+
});
39+
40+
$.export("$summary", `Successfully calculated A/D Line for ${this.ticker} on ${this.interval} intervals`);
41+
return response;
42+
},
43+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import mboum from "../../mboum.app.mjs";
2+
3+
export default {
4+
key: "mboum-get-adosc",
5+
name: "Get Accumulation/Distribution Oscillator (ADOSC)",
6+
description: "Calculate Accumulation/Distribution Oscillator technical indicator to measure the momentum of volume flow. [See the documentation](https://docs.mboum.com/#stocks-options-small-stylecolor-f8f2f2background-fa256fpadding-1px-4pxborder-radius-3pxhotsmall-GETapi-v1-markets-indicators-adosc)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mboum,
11+
ticker: {
12+
propDefinition: [
13+
mboum,
14+
"ticker",
15+
],
16+
},
17+
interval: {
18+
propDefinition: [
19+
mboum,
20+
"interval",
21+
],
22+
},
23+
seriesType: {
24+
propDefinition: [
25+
mboum,
26+
"seriesType",
27+
],
28+
},
29+
fastPeriod: {
30+
type: "integer",
31+
label: "Fast Period",
32+
description: "Fast period for ADOSC calculation",
33+
optional: true,
34+
},
35+
slowPeriod: {
36+
type: "integer",
37+
label: "Slow Period",
38+
description: "Slow period for ADOSC calculation",
39+
optional: true,
40+
},
41+
limit: {
42+
propDefinition: [
43+
mboum,
44+
"limit",
45+
],
46+
},
47+
},
48+
async run({ $ }) {
49+
const response = await this.mboum.getADOSC({
50+
$,
51+
params: {
52+
ticker: this.ticker,
53+
interval: this.interval,
54+
series_type: this.seriesType,
55+
fast_period: this.fastPeriod,
56+
slow_period: this.slowPeriod,
57+
limit: this.limit,
58+
},
59+
});
60+
61+
$.export("$summary", `Successfully calculated ADOSC(${this.fastPeriod},${this.slowPeriod}) for ${this.ticker} on ${this.interval} intervals`);
62+
return response;
63+
},
64+
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import mboum from "../../mboum.app.mjs";
2+
3+
export default {
4+
key: "mboum-get-adx",
5+
name: "Get Average Directional Index (ADX)",
6+
description: "Calculate Average Directional Index technical indicator to measure trend strength and direction. [See the documentation](https://docs.mboum.com/#stocks-options-small-stylecolor-f8f2f2background-fa256fpadding-1px-4pxborder-radius-3pxhotsmall-GETapi-v1-markets-indicators-adx)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mboum,
11+
ticker: {
12+
propDefinition: [
13+
mboum,
14+
"ticker",
15+
],
16+
},
17+
interval: {
18+
propDefinition: [
19+
mboum,
20+
"interval",
21+
],
22+
},
23+
seriesType: {
24+
propDefinition: [
25+
mboum,
26+
"seriesType",
27+
],
28+
},
29+
timePeriod: {
30+
type: "integer",
31+
label: "Time Period",
32+
description: "Number of periods for ADX calculation",
33+
optional: true,
34+
},
35+
limit: {
36+
propDefinition: [
37+
mboum,
38+
"limit",
39+
],
40+
},
41+
},
42+
async run({ $ }) {
43+
const response = await this.mboum.getADX({
44+
$,
45+
params: {
46+
ticker: this.ticker,
47+
interval: this.interval,
48+
series_type: this.seriesType,
49+
time_period: this.timePeriod,
50+
limit: this.limit,
51+
},
52+
});
53+
54+
$.export("$summary", `Successfully calculated ADX(${this.timePeriod}) for ${this.ticker} on ${this.interval} intervals`);
55+
return response;
56+
},
57+
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import mboum from "../../mboum.app.mjs";
2+
3+
export default {
4+
key: "mboum-get-cci",
5+
name: "Get Commodity Channel Index (CCI)",
6+
description: "Calculate Commodity Channel Index technical indicator to identify cyclical trends and overbought/oversold conditions. [See the documentation](https://docs.mboum.com/#stocks-options-small-stylecolor-f8f2f2background-fa256fpadding-1px-4pxborder-radius-3pxhotsmall-GETapi-v1-markets-indicators-cci)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mboum,
11+
ticker: {
12+
propDefinition: [
13+
mboum,
14+
"ticker",
15+
],
16+
},
17+
interval: {
18+
propDefinition: [
19+
mboum,
20+
"interval",
21+
],
22+
},
23+
seriesType: {
24+
propDefinition: [
25+
mboum,
26+
"seriesType",
27+
],
28+
},
29+
timePeriod: {
30+
type: "integer",
31+
label: "Time Period",
32+
description: "Number of periods for CCI calculation",
33+
optional: true,
34+
},
35+
limit: {
36+
propDefinition: [
37+
mboum,
38+
"limit",
39+
],
40+
},
41+
},
42+
async run({ $ }) {
43+
const response = await this.mboum.getCCI({
44+
$,
45+
params: {
46+
ticker: this.ticker,
47+
interval: this.interval,
48+
series_type: this.seriesType,
49+
time_period: this.timePeriod,
50+
limit: this.limit,
51+
},
52+
});
53+
54+
$.export("$summary", `Successfully calculated CCI(${this.timePeriod}) for ${this.ticker} on ${this.interval} intervals`);
55+
return response;
56+
},
57+
};

components/mboum/actions/get-history/get-history.mjs

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import mboum from "../../mboum.app.mjs";
2+
import constants from "../../common/constants.mjs";
23

34
export default {
45
key: "mboum-get-history",
@@ -18,44 +19,7 @@ export default {
1819
type: "string",
1920
label: "Interval",
2021
description: "Time interval between two consecutive data points in the time series",
21-
options: [
22-
{
23-
value: "1m",
24-
label: "1 min candles",
25-
},
26-
{
27-
value: "2m",
28-
label: "2 min candles",
29-
},
30-
{
31-
value: "3m",
32-
label: "3 min candles",
33-
},
34-
{
35-
value: "5m",
36-
label: "5 mins candles",
37-
},
38-
{
39-
value: "15m",
40-
label: "15 mins candles",
41-
},
42-
{
43-
value: "30m",
44-
label: "30 mins candles",
45-
},
46-
{
47-
value: "1wk",
48-
label: "weekly candles",
49-
},
50-
{
51-
value: "1mo",
52-
label: "monthly candles",
53-
},
54-
{
55-
value: "1qty",
56-
label: "quarterly candles",
57-
},
58-
],
22+
options: constants.HISTORICAL_DATA_INTERVALS,
5923
},
6024
limit: {
6125
type: "integer",

components/mboum/actions/get-institutional-holdings/get-institutional-holdings.mjs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import mboum from "../../mboum.app.mjs";
2+
import constants from "../../common/constants.mjs";
23

34
export default {
45
key: "mboum-get-institutional-holdings",
@@ -18,14 +19,7 @@ export default {
1819
type: "string",
1920
label: "Type",
2021
description: "Type of institutional holdings to retrieve",
21-
options: [
22-
"TOTAL",
23-
"INCREASED",
24-
"NEW",
25-
"DECREASED",
26-
"SOLDOUT",
27-
"ACTIVITY",
28-
],
22+
options: constants.INTERNATIONAL_HOLDINGS_TYPES,
2923
},
3024
limit: {
3125
type: "integer",
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import mboum from "../../mboum.app.mjs";
2+
3+
export default {
4+
key: "mboum-get-macd",
5+
name: "Get MACD",
6+
description: "Calculate Moving Average Convergence Divergence (MACD) technical indicator to identify trend changes and momentum. [See the documentation](https://docs.mboum.com/#stocks-options-small-stylecolor-f8f2f2background-fa256fpadding-1px-4pxborder-radius-3pxhotsmall-GETapi-v1-markets-indicators-macd)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mboum,
11+
ticker: {
12+
propDefinition: [
13+
mboum,
14+
"ticker",
15+
],
16+
},
17+
interval: {
18+
propDefinition: [
19+
mboum,
20+
"interval",
21+
],
22+
},
23+
seriesType: {
24+
propDefinition: [
25+
mboum,
26+
"seriesType",
27+
],
28+
},
29+
fastPeriod: {
30+
type: "integer",
31+
label: "Fast Period",
32+
description: "Fast period for MACD calculation",
33+
optional: true,
34+
},
35+
slowPeriod: {
36+
type: "integer",
37+
label: "Slow Period",
38+
description: "Slow period for MACD calculation",
39+
optional: true,
40+
},
41+
signalPeriod: {
42+
type: "integer",
43+
label: "Signal Period",
44+
description: "Signal line period for MACD calculation",
45+
optional: true,
46+
},
47+
limit: {
48+
propDefinition: [
49+
mboum,
50+
"limit",
51+
],
52+
},
53+
},
54+
async run({ $ }) {
55+
const response = await this.mboum.getMACD({
56+
$,
57+
params: {
58+
ticker: this.ticker,
59+
interval: this.interval,
60+
series_type: this.seriesType,
61+
fast_period: this.fastPeriod,
62+
slow_period: this.slowPeriod,
63+
signal_period: this.signalPeriod,
64+
limit: this.limit,
65+
},
66+
});
67+
68+
$.export("$summary", `Successfully calculated MACD(${this.fastPeriod},${this.slowPeriod},${this.signalPeriod}) for ${this.ticker} on ${this.interval} intervals`);
69+
return response;
70+
},
71+
};

0 commit comments

Comments
 (0)