Skip to content

Commit

Permalink
Merge pull request TulipCharts#24 from cirla/fix_22
Browse files Browse the repository at this point in the history
Fix TulipCharts#22, Update to TI 0.8.3
  • Loading branch information
cirla committed Sep 14, 2018
2 parents edd6819 + e79d9fb commit e6df8c3
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 61 deletions.
14 changes: 11 additions & 3 deletions .travis.yml
@@ -1,11 +1,19 @@
language: python
python:
- '2.7'
- '3.6'

matrix:
include:
- python: 2.7
- python: 3.6
- python: 3.7
dist: xenial
sudo: true

install:
- pip install --upgrade pip setuptools wheel
- pip install --only-binary=Cython,numpy -r requirements.txt

script: make test

deploy:
provider: pypi
user: cirla
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -29,7 +29,7 @@ ti.TI_VERSION



'0.8.2'
'0.8.3'



Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Expand Up @@ -8,14 +8,14 @@ environment:
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "32"
- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6"
- PYTHON: "C:\\Python37"
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "32"
- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6"
- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"

install:
Expand Down
31 changes: 24 additions & 7 deletions libindicators/indicators.h
Expand Up @@ -24,8 +24,8 @@

/*
*
* Version 0.8.2
* Header Build 1521563742
* Version 0.8.3
* Header Build 1535408446
*
*/

Expand All @@ -39,11 +39,9 @@
#define __TI_INDICATORS_H__


#define TI_VERSION "0.8.2"
#define TI_BUILD 1521563742
#define TI_VERSION "0.8.3"
#define TI_BUILD 1535408446

const char* ti_version();
long int ti_build();

#ifndef TI_SKIP_SYSTEM_HEADERS
#include <math.h>
Expand All @@ -57,13 +55,16 @@ extern "C" {
#endif


const char* ti_version();
long int ti_build();





#define TI_REAL double

#define TI_INDICATOR_COUNT 103 /* Total number of indicators. */
#define TI_INDICATOR_COUNT 104 /* Total number of indicators. */

#define TI_OKAY 0
#define TI_INVALID_OPTION 1
Expand Down Expand Up @@ -1360,6 +1361,22 @@ int ti_stoch(int size,



/* Stochastic RSI */
/* Type: indicator */
/* Input arrays: 1 Options: 1 Output arrays: 1 */
/* Inputs: real */
/* Options: period */
/* Outputs: stochrsi */
int ti_stochrsi_start(TI_REAL const *options);
int ti_stochrsi(int size,
TI_REAL const *const *inputs,
TI_REAL const *options,
TI_REAL *const *outputs);





/* Vector Subtraction */
/* Type: simple */
/* Input arrays: 2 Options: 0 Output arrays: 1 */
Expand Down
172 changes: 130 additions & 42 deletions libindicators/tiamalgamation.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions requirements.txt
@@ -1,2 +1,2 @@
Cython==0.28.1
numpy==1.14.2
Cython==0.28.5
numpy==1.15.1
7 changes: 6 additions & 1 deletion setup.py
Expand Up @@ -4,6 +4,9 @@
import numpy as np
from Cython.Distutils import build_ext

with open('README.md') as f:
long_description = f.read()

ext_modules = [
Extension(name='tulipy.lib',
sources=['libindicators/tiamalgamation.c', 'tulipy/lib/__init__.pyx'],
Expand All @@ -15,7 +18,9 @@
setup(
name='tulipy',
description='Financial Technical Analysis Indicator Library. Python bindings for https://github.com/TulipCharts/tulipindicators',
version='0.2.1',
long_description=long_description,
long_description_content_type='text/markdown',
version='0.3.0',
url='https://github.com/cirla/tulipy',
author='https://github.com/cirla/tulipy/blob/master/AUTHORS',
license='LGPL-3.0',
Expand Down
10 changes: 9 additions & 1 deletion tulipy/lib/__init__.pyx
Expand Up @@ -42,6 +42,9 @@ TI_BUILD = ti.TI_BUILD
class InvalidOptionError(ValueError):
pass

class InvalidInputError(ValueError):
pass

cdef dict _type_names = {
ti.TI_TYPE_OVERLAY: b'overlay',
ti.TI_TYPE_INDICATOR: b'indicator',
Expand Down Expand Up @@ -105,7 +108,12 @@ cdef class _Indicator:
cdef np.ndarray[np.float64_t, ndim=1, mode='c'] input_ref

for i in range(self.info.inputs):
input_ref = inputs[i][-min_input_len:]
if inputs[i].dtype == np.float64:
input_ref = inputs[i][-min_input_len:]
elif np.issubdtype(inputs[i].dtype, np.number):
input_ref = inputs[i][-min_input_len:].astype(np.float64)
else:
raise InvalidInputError("Input arrays must have a numeric dtype")
c_inputs[i] = &input_ref[0]

cdef ti.TI_REAL * c_outputs[ti.TI_MAXINDPARAMS]
Expand Down

0 comments on commit e6df8c3

Please sign in to comment.