GithubHelp home page GithubHelp logo

yageek / tulipindicators-swift Goto Github PK

View Code? Open in Web Editor NEW
22.0 3.0 3.0 434 KB

:bar_chart: Swift Technical Analysis library around tulip

Home Page: https://yageek.github.io/tulipindicators-swift/

License: GNU Lesser General Public License v3.0

Swift 18.55% C 80.67% Objective-C 0.46% Ruby 0.32%
technical-analysis tulip swift

tulipindicators-swift's Introduction

tulipindicators-swift

License Carthage compatible Cocoapods

This swift package offers a technical analysis function by wrapping the tulipindicators C library

Installation

You can access the documentation here

Swift package manager

import PackageDescription

let package = Package(
    dependencies: [
        .package(url: "https://github.com/yageek/tulipindicators-swift.git", from: "1.0.1"),
    ]
)

Carthage

github "yageek/tulipindicators-swift" ~> 1.0.1

Cocoapods

pod 'tulipindicators-swift' ~> 1.0.1

Usage

import tulipindicators

let inputs: [Double] = [81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36, 85.53, 86.54, 86.89, 87.77, 87.29]
let (beginIdx, outputs) = msw(inputs, period: 5)

print("Relative Input offset: \(beginIdx)")
print("MSW values: \(outputs)")

tulipindicators-swift's People

Contributors

yageek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tulipindicators-swift's Issues

Objc version?

I tried to import the framework in my objc framework but couldn't. Can you provide a sample for objc?

Edit: Never mind, did that by using bridge.

Average Directional Movement Rating (adxr) implemented as Average Directional Movement Index (adx)

/// Average Directional Movement Index
/// - Parameter inputs: An array of Quotable elements
/// - Parameter period: The period
public func adx<T: Quotable>(_ inputs: [T], period n: Int) -> (Int, [Double]) {
return Tulip.shared.call_indicator(name: "adx", inputs: HLC(inputs), options: [Double(n)])
}

Remove next.

/// Average Directional Movement Rating
/// - Parameter inputs: An array of Quotable elements
/// - Parameter period: The period
public func adxr<T: Quotable>(_ inputs: [T], period n: Int) -> (Int, [Double]) {
return Tulip.shared.call_indicator(name: "adx", inputs: HLC(inputs), options: [Double(n)])
}

Replace with

// Average Directional Movement Rating
/// - Parameter inputs: An array of Quotable elements
/// - Parameter period: The period
public func adxr<T: Quotable>(_ inputs: [T], period n: Int) -> (Int, [Double]) {
return Tulip.shared.call_indicator(name: "adxr", inputs: HLC(inputs), options: [Double(n)])
}

No such module 'tulipindicators'

I get this error after installing and importing the module; tried with SPM, CocoaPod and Carthage, always getting this error. Running on Xcode 11.6.

Any hint?

Negative Volume index (nvi) implemented as Normalized Average True range (natr)

/// Normalized Average True Range
/// - Parameter inputs: An array of Quotable elements.
public func natr<T: Quotable>(_ inputs: [T], period n: Int) -> (Int, [Double]) {
return Tulip.shared.call_indicator(name: "natr", inputs: HLC(inputs), options: [Double(n)])
}

Remove next:

/// Normalized Average True Range
/// - Parameter inputs: An array of Quotable elements.
public func nvi<T: Quotable>(_ inputs: [T], period n: Int) -> (Int, [Double]) {
return Tulip.shared.call_indicator(name: "natr", inputs: CV(inputs), options: [Double(n)])
}

Replace with:

/// Negative Volume Index
/// - Parameter inputs: An array of Quotable elements.
public func nvi<T: Quotable>(_ inputs: [T]) -> (Int, [Double]) {
return Tulip.shared.call_indicator(name: "nvi", inputs: CV(inputs), options: [])
}

Cocoapods wrong module name

The cocoapods spec forgot to override the module name until version 1.0.1.

Instead of doing:

import tulipindicators

Use as a workaround:

import tulipindicators_swift

This will be fixed in the next version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.