Skip to content

Commit

Permalink
feat: SMA and EMA indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed Oct 15, 2024
1 parent 1a6bf9d commit 598424a
Show file tree
Hide file tree
Showing 6 changed files with 666 additions and 0 deletions.
234 changes: 234 additions & 0 deletions packages/indicators/src/indicators/__snapshots__/ema.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`ema > should calculate EMA 1`] = `
[
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
1945.1164285714283,
1960.2342380952377,
1960.431006349206,
1960.468205502645,
1960.752444768959,
1967.5201187997645,
1974.704102959796,
1969.19155589849,
1981.743348445358,
1992.44423531931,
2004.209003943402,
2014.7211367509483,
2021.067651850822,
2021.979964937379,
2025.487969612395,
2025.930906997409,
2029.3934527310878,
2037.1223257002762,
2054.1366822735727,
2072.62645797043,
2095.3722635743725,
2121.7652950977895,
2136.580589084751,
2165.793843873451,
2191.509331356991,
2211.3907538427256,
2230.1719866636954,
2229.457055108536,
2225.9814477607315,
2230.518588059301,
2241.796109651394,
2238.9712950312082,
2237.6044556937136,
2232.1211949345516,
2230.418368943278,
2223.401253084174,
2220.569086006284,
2223.0798745387797,
2236.6438912669423,
2246.19137243135,
2248.567189440503,
2251.571564181769,
2248.7873556242,
2266.0397082076397,
2276.462413779954,
2279.4927586092936,
2281.103057461388,
2281.2226497998695,
2290.6062964932203,
2299.218790294124,
2287.2816182549077,
2284.59073582092,
2282.430637711464,
2276.899886016602,
2269.525234547722,
2277.6952032746926,
2286.586509504734,
2326.2856415707693,
2365.1822226946665,
2386.196593002044,
2411.7703806017716,
2419.9089965215353,
2432.161130318664,
2452.878312942842,
2463.1918712171296,
2464.2049550548454,
2467.8869610475326,
2468.454032907862,
2466.926828520147,
2446.5605847174606,
2419.373840088466,
2394.82932807667,
2371.338750999781,
2357.5095841998104,
2345.5883063065025,
2333.7525321323023,
2331.6215278479954,
2333.1066574682627,
2326.457769805828,
2323.4607338317173,
2321.5206359874883,
2318.1965511891567,
2314.3850110306025,
2312.701676226522,
2320.704119396319,
2334.63690347681,
2345.962649679902,
2364.712963055915,
2382.7845679817933,
2399.359958917554,
2434.0866310618803,
2461.5524135869628,
2503.320091775368,
2545.9294128719857,
2580.0721578223875,
2607.5505367794026,
2644.0384652088155,
2684.08666984764,
2728.1617805346214,
2760.0308764633387,
2788.213426268227,
2806.070302765797,
2830.923595730357,
2868.5577829663093,
2909.5140785708013,
2953.9002014280277,
3011.124174570957,
3054.9996179614964,
3105.3916688999634,
3147.515446379968,
3192.8947201959722,
3250.842090836509,
3291.180478724975,
3361.6337482283116,
3429.23458179787,
3489.7633042248203,
3545.128196994844,
3589.5671040621983,
3652.942156853905,
3696.5525359400513,
3737.680197814711,
3756.9335047727495,
3755.0223708030494,
3724.1007213626426,
3713.448625180957,
3687.790141823496,
3617.22345624703,
3603.7029954140926,
3588.9172626922136,
3555.3016276665853,
3525.2160773110404,
3515.804600336235,
3525.7199869580704,
3533.922655363661,
3529.704967981839,
3533.8283055842608,
3530.5498648396924,
3527.1752161944,
3542.8998540351467,
3537.7772068304607,
3503.262912586399,
3477.6398575748794,
3457.6878765648953,
3439.0094930229093,
3427.4202272865214,
3430.996196981652,
3466.2193707174315,
3471.4981212884404,
3481.351705116648,
3484.183477767762,
3451.3030140653937,
3391.8879455233414,
3360.237552786896,
3325.8058790819764,
3293.5650952043798,
3252.449749177129,
3227.375115953512,
3204.5744338263767,
3198.0458426495265,
3191.298396962923,
3192.5426107012,
3196.1009292743734,
3188.678138704457,
3184.3370535438626,
3177.282779738014,
3187.7530757729455,
3197.847332336553,
3200.401021358346,
3175.6075518438997,
3148.4932115980464,
3126.9207833849737,
3123.694012266977,
3122.82281063138,
3124.6584358805294,
3116.4266444297923,
3101.7564251724866,
3084.7222351494884,
3078.2552704628897,
3055.8305677345043,
3036.703825369904,
3022.42198198725,
3012.8737177222833,
2995.4518886926458,
3000.3556368669597,
2992.9495519513653,
3006.1229450245164,
]
`;

exports[`ema > should calculate EMA for 1h candles 1`] = `
[
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
NaN,
2909.5485714285714,
2910.8114285714287,
2912.119238095238,
2913.4553396825395,
2913.1066277248674,
2912.859077361552,
2912.0912003800117,
2910.98170699601,
2909.641479396542,
2910.215948810336,
2909.1711556356245,
]
`;
Loading

0 comments on commit 598424a

Please sign in to comment.