Skip to content

thrasher-corp/gct-ta

Repository files navigation

GCT-TA

GC-TA is a technical analysis library used as part of GoCryptoTrader This project orignally started off as a fork of go-talib

Supported indicators so far:

  • Average True Range
  • Bollinger Bands
  • Simple Moving Average
  • Exponential Moving Average
  • MACD
  • Money Flow Index
  • On Balance Volume
  • RSI

Install

Install the package with:

go get github.com/thrasher-corp/gct-ta

Import it with:

import "github.com/thrasher-corp/gct-ta/pkg/indicators"

Example

package main

import (
    "fmt"
    "github.com/thrasher-corp/gct-ta/pkg/indicators"
)

var (
	testTimestamp = []float64{1577059200, 1577145600, 1577232000, 1577318400, 1577404800, 1577491200, 1577577600, 1577664000, 1577750400, 1577836800, 1577923200, 1578009600, 1578096000, 1578182400, 1578268800, 1578355200, 1578441600, 1578528000, 1578614400, 1578700800, 1578787200, 1578873600, 1578960000, 1579046400, 1579132800, 1579219200, 1579305600, 1579392000, 1579478400, 1579564800, 1579651200, 1579737600, 1579824000, 1579910400, 1579996800, 1580083200, 1580169600, 1580256000, 1580342400, 1580428800, 1580515200, 1580601600, 1580688000, 1580774400, 1580860800, 1580947200, 1581033600, 1581120000, 1581206400, 1581292800, 1581379200, 1581465600, 1581552000, 1581638400, 1581724800, 1581811200, 1581897600, 1581984000, 1582070400, 1582156800, 1582243200, 1582329600, 1582416000, 1582502400, 1582588800, 1582675200, 1582761600, 1582848000, 1582934400, 1583020800, 1583107200, 1583193600, 1583280000, 1583366400, 1583452800, 1583539200, 1583625600, 1583712000, 1583798400, 1583884800, 1583971200, 1584057600, 1584144000, 1584230400, 1584316800, 1584403200, 1584489600, 1584576000, 1584662400, 1584748800, 1584835200, 1584921600, 1585008000, 1585094400, 1585180800, 1585267200, 1585353600, 1585440000, 1585526400, 1585612800}
	testOpen      = []float64{7147.4, 7521.88, 7317.47, 7247.45, 7195.8, 7195.17, 7247.7, 7297.43, 7372.79, 7222.74, 7160.69, 7174.7, 6945.7, 7332.58, 7356.05, 7352.12, 7768.17, 8151.79, 8048.94, 7812.7, 8200, 8008.1, 8180.75, 8105.01, 8813.2, 8810.62, 8715.39, 8898.03, 8901.02, 8698.97, 8629.66, 8728.47, 8661.63, 8382.08, 8435.83, 8320, 8600, 8894.57, 9386.57, 9280.83, 9510.84, 9339.26, 9379.6, 9309.69, 9281, 9168.49, 9617.84, 9754.63, 9803.71, 9907.7, 10173.51, 9851.99, 10270.98, 10348.78, 10229.19, 10364.04, 9909.71, 9925.96, 9725.57, 10190.3, 9589.1, 9610.4, 9696.13, 9664.08, 9969.79, 9664.87, 9305.4, 8778.37, 8816.5, 8710, 8525, 8516, 8917.34, 8755.45, 8757.79, 9059, 9154.1, 8901.12, 8035.79, 7937.2, 7893.63, 7956.29, 4841.67, 5623.16, 5167.38, 5353.04, 5051.41, 5340.95, 5413, 6192.94, 6207.66, 6199.17, 5816.57, 6494.7, 6768.64, 6695.47, 6765.15, 6376.03, 6275.11, 5878.47}
	testHigh      = []float64{7530, 7692.98, 7431.1, 7266.81, 7432, 7255.37, 7349.65, 7524.46, 7384.9, 7302.35, 7237.35, 7184.94, 7402.31, 7396.1, 7495, 7817, 8220, 8463.57, 8048.94, 8200, 8286, 8190, 8196.81, 8895, 8903.2, 8852.35, 9015.22, 9000.1, 9188.1, 8740.54, 8778.66, 8792.98, 8665.95, 8530.7, 8437.47, 8600, 9004.35, 9413.24, 9443.96, 9570, 9529.35, 9464.16, 9474.28, 9615, 9348.6, 9775, 9859.57, 9878, 9948.97, 10178.54, 10199.85, 10383.9, 10495, 10500.5, 10398, 10408.04, 10051.24, 9973.45, 10288, 10300, 9706.27, 9773.2, 9722.39, 10024.08, 10027.66, 9682.73, 9369.99, 8974.75, 8900.94, 8805.06, 8756.11, 8980.34, 8921.8, 8850, 9169, 9187.85, 9219.13, 8901.12, 8191.13, 8158.42, 7988.78, 7969.9, 5990.35, 5663.01, 5965.77, 5353.04, 5569.9, 5452.43, 6433.98, 7139, 6461.91, 6419, 6629.79, 6893, 6989.04, 6798.89, 6872.67, 6376.03, 6278.24, 5951.92}
	testLow       = []float64{7124.52, 7247.86, 7156, 7110.73, 7150, 7052, 7231, 7274.43, 7199, 7112.55, 7150, 6900, 6853.53, 7256.03, 7310, 7342.46, 7697.03, 7872.09, 7737.97, 7667, 8000, 7960, 8039, 8105.01, 8555, 8573.91, 8661.52, 8798.9, 8461.38, 8507.93, 8480, 8567.68, 8280, 8212.9, 8252.72, 8276.22, 8546.55, 8876, 9215.5, 9166.07, 9195.93, 9280.33, 9135, 9211.07, 9075, 9142.52, 9521, 9706.94, 9658.58, 9885.04, 9731.2, 9706.94, 10247.35, 10068, 10093.26, 9739, 9598.49, 9467.57, 9602.6, 9312, 9396.91, 9562.6, 9568.51, 9664.08, 9480, 9234.21, 8627.78, 8520, 8421.49, 8525, 8410, 8486.72, 8660.04, 8663.76, 8757.79, 8990.01, 8859.49, 7995.48, 7636, 7733.99, 7591.99, 4776.59, 3850, 5051, 5092.34, 4435.89, 4936, 5006.87, 5266.38, 5670, 5866.44, 5705, 5686.34, 6400.01, 6457.17, 6528.07, 6210, 6030.51, 5869, 5856}
	testClose     = []float64{7509.7, 7316.17, 7251.52, 7195.79, 7188.3, 7246, 7296.24, 7385.54, 7220.24, 7168.36, 7178.68, 6950.56, 7338.91, 7344.48, 7356.7, 7762.74, 8159.01, 8044.44, 7806.78, 8200, 8016.22, 8180.76, 8105.01, 8813.04, 8809.17, 8710.15, 8892.63, 8908.53, 8696.6, 8625.17, 8717.89, 8655.93, 8378.44, 8422.13, 8329.5, 8590.48, 8894.54, 9400, 9289.18, 9500, 9327.85, 9377.17, 9329.39, 9288.09, 9159.37, 9618.42, 9754.63, 9803.42, 9902, 10173.97, 9850.01, 10268.98, 10348.78, 10228.67, 10364.04, 9899.78, 9912.89, 9697.15, 10185.17, 9595.72, 9612.76, 9696.13, 9668.13, 9965.21, 9652.58, 9305.4, 8779.36, 8816.5, 8703.84, 8527.74, 8528.95, 8917.34, 8755.45, 8753.28, 9066.65, 9153.79, 8893.93, 8033.7, 7936.25, 7885.92, 7934.57, 4841.67, 5622.74, 5169.37, 5343.64, 5033.42, 5324.99, 5406.92, 6181.18, 6210.14, 6187.78, 5813.15, 6493.51, 6768.64, 6692.22, 6760.72, 6376.03, 6253.08, 5870.9, 5947.01}
	testVolume    = []float64{3796.23, 6710.77, 4194.59, 1504.53, 3116.75, 4024.57, 1579.7, 2583.85, 3722.91, 2638.69, 1119.11, 3972.71, 8072.73, 3256.74, 2707.27, 6728.28, 12158.32, 11913.23, 5957.24, 8999.99, 3788.33, 2056.09, 4011.44, 17009.43, 8606.35, 6713.26, 9363.16, 3678.01, 8785.45, 4420.2, 3394.69, 3143.81, 8611.01, 6430.43, 2812.79, 6340.59, 9619.77, 9565.56, 6481.92, 7945.16, 5009.62, 1669.0, 3015.79, 4758.13, 4867.23, 8063.97, 7554.49, 4013.49, 3268.74, 4830.34, 7560.67, 8127.6, 6553.41, 9347.45, 6190.38, 5762.31, 4133.48, 5913.2, 6754.35, 9936.82, 6608.49, 4271.47, 2096.56, 3329.22, 5877.01, 6280.0, 11564.2, 9273.9, 6546.98, 2338.07, 4156.57, 6186.86, 4629.97, 3353.23, 6448.69, 4136.42, 2805.59, 9068.89, 12177.39, 8274.95, 7289.61, 58513.39, 54419.64, 15370.87, 16589.3, 34905.46, 17517.84, 22559.23, 24783.73, 30082.5, 11796.73, 10813.38, 19053.8, 19719.09, 16675.74, 7393.71, 10816.29, 11613.49, 9298.94, 548.62}
)


func main() {
    ret := indicators.OBV(testClose, testVolume)
    fmt.Println(ret)
}

License

MIT License - see LICENSE for more details

About

GoCryptoTrader technical analysis library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published