Skip to content

Commit d1a2cfd

Browse files
committedOct 4, 2020
Rename feature serde_support to serde
1 parent 85bc708 commit d1a2cfd

21 files changed

+40
-43
lines changed
 

‎Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ include = [
1717
"README.md"
1818
]
1919

20-
[features]
21-
serde_support = ["serde"]
22-
2320
[badges]
2421
travis-ci = { repository = "greyblake/ta-rs", branch = "master" }
2522

‎src/indicators/average_true_range.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::errors::*;
44
use crate::indicators::{ExponentialMovingAverage, TrueRange};
55
use crate::{Close, High, Low, Next, Reset};
66

7-
#[cfg(feature = "serde_support")]
7+
#[cfg(feature = "serde")]
88
use serde::{Deserialize, Serialize};
99

1010
/// Average true range (ATR).
@@ -56,7 +56,7 @@ use serde::{Deserialize, Serialize};
5656
/// assert_approx_eq!(indicator.next(&di), atr);
5757
/// }
5858
/// }
59-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
59+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6060
#[derive(Debug, Clone)]
6161
pub struct AverageTrueRange {
6262
true_range: TrueRange,

‎src/indicators/bollinger_bands.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33
use crate::errors::*;
44
use crate::indicators::StandardDeviation as Sd;
55
use crate::{Close, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// A Bollinger Bands (BB).
@@ -45,7 +45,7 @@ use serde::{Deserialize, Serialize};
4545
/// # Links
4646
///
4747
/// ![Bollinger Bands, Wikipedia](https://en.wikipedia.org/wiki/Bollinger_Bands)
48-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
48+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4949
#[derive(Debug, Clone)]
5050
pub struct BollingerBands {
5151
length: u32,

‎src/indicators/efficiency_ratio.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33

44
use crate::errors::*;
55
use crate::traits::{Close, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Kaufman's Efficiency Ratio (ER).
@@ -30,7 +30,7 @@ use serde::{Deserialize, Serialize};
3030
/// assert_eq!(er.next(19.0), 0.75);
3131
/// ```
3232
33-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
33+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
3434
pub struct EfficiencyRatio {
3535
length: u32,
3636
prices: VecDeque<f64>,

‎src/indicators/exponential_moving_average.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt;
22

33
use crate::errors::*;
44
use crate::{Close, Next, Reset};
5-
#[cfg(feature = "serde_support")]
5+
#[cfg(feature = "serde")]
66
use serde::{Deserialize, Serialize};
77

88
/// An exponential moving average (EMA), also known as an exponentially weighted moving average
@@ -52,7 +52,7 @@ use serde::{Deserialize, Serialize};
5252
/// * [Exponential moving average, Wikipedia](https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average)
5353
///
5454
55-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
55+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5656
#[derive(Debug, Clone)]
5757
pub struct ExponentialMovingAverage {
5858
length: u32,

‎src/indicators/fast_stochastic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33
use crate::errors::*;
44
use crate::indicators::{Maximum, Minimum};
55
use crate::{Close, High, Low, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Fast stochastic oscillator.
@@ -40,7 +40,7 @@ use serde::{Deserialize, Serialize};
4040
/// assert_eq!(stoch.next(35.0), 75.0);
4141
/// assert_eq!(stoch.next(15.0), 0.0);
4242
/// ```
43-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
43+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4444
#[derive(Debug, Clone)]
4545
pub struct FastStochastic {
4646
length: u32,

‎src/indicators/keltner_channel.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33
use crate::errors::*;
44
use crate::indicators::{AverageTrueRange, ExponentialMovingAverage};
55
use crate::{Close, High, Low, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Keltner Channel (KC).
@@ -46,7 +46,7 @@ use serde::{Deserialize, Serialize};
4646
/// # Links
4747
///
4848
/// * [Keltner channel, Wikipedia](https://en.wikipedia.org/wiki/Keltner_channel)
49-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
49+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5050
#[derive(Debug, Clone)]
5151
pub struct KeltnerChannel {
5252
length: u32,

‎src/indicators/maximum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33

44
use crate::errors::*;
55
use crate::{High, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Returns the highest value in a given time frame.
@@ -25,7 +25,7 @@ use serde::{Deserialize, Serialize};
2525
/// assert_eq!(max.next(4.0), 5.0);
2626
/// assert_eq!(max.next(8.0), 8.0);
2727
/// ```
28-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
28+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
2929
#[derive(Debug, Clone)]
3030
pub struct Maximum {
3131
n: usize,

‎src/indicators/minimum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33

44
use crate::errors::*;
55
use crate::{Low, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Returns the lowest value in a given time frame.
@@ -24,7 +24,7 @@ use serde::{Deserialize, Serialize};
2424
/// assert_eq!(min.next(12.0), 10.0);
2525
/// assert_eq!(min.next(13.0), 11.0);
2626
/// ```
27-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
27+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
2828
#[derive(Debug, Clone)]
2929
pub struct Minimum {
3030
n: usize,

‎src/indicators/money_flow_index.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33

44
use crate::errors::*;
55
use crate::{Close, High, Low, Next, Reset, Volume};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Money Flow Index (MFI).
@@ -53,7 +53,7 @@ use serde::{Deserialize, Serialize};
5353
/// * [Money Flow Index, Wikipedia](https://en.wikipedia.org/wiki/Money_flow_index)
5454
/// * [Money Flow Index, stockcharts](https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:money_flow_index_mfi)
5555
56-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
56+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5757
#[derive(Debug, Clone)]
5858
pub struct MoneyFlowIndex {
5959
n: u32,

‎src/indicators/moving_average_convergence_divergence.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33
use crate::errors::*;
44
use crate::indicators::ExponentialMovingAverage as Ema;
55
use crate::{Close, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Moving average converge divergence (MACD).
@@ -50,7 +50,7 @@ use serde::{Deserialize, Serialize};
5050
/// (n0, n1, n2)
5151
/// }
5252
/// ```
53-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
53+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5454
#[derive(Debug, Clone)]
5555
pub struct MovingAverageConvergenceDivergence {
5656
fast_ema: Ema,

‎src/indicators/on_balance_volume.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt;
22

33
use crate::{Close, Next, Reset, Volume};
4-
#[cfg(feature = "serde_support")]
4+
#[cfg(feature = "serde")]
55
use serde::{Deserialize, Serialize};
66

77
/// On Balance Volume (OBV).
@@ -58,7 +58,7 @@ use serde::{Deserialize, Serialize};
5858
/// * [On Balance Volume, Wikipedia](https://en.wikipedia.org/wiki/On-balance_volume)
5959
/// * [On Balance Volume, stockcharts](https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:on_balance_volume_obv)
6060
61-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
61+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6262
#[derive(Debug, Clone)]
6363
pub struct OnBalanceVolume {
6464
obv: f64,

‎src/indicators/percentage_price_oscillator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33
use crate::errors::*;
44
use crate::indicators::ExponentialMovingAverage as Ema;
55
use crate::{Close, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Percentage Price Oscillator (PPO).
@@ -50,7 +50,7 @@ use serde::{Deserialize, Serialize};
5050
/// (n0, n1, n2)
5151
/// }
5252
/// ```
53-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
53+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5454
#[derive(Debug, Clone)]
5555
pub struct PercentagePriceOscillator {
5656
fast_ema: Ema,

‎src/indicators/rate_of_change.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33

44
use crate::errors::*;
55
use crate::traits::{Close, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Rate of Change (ROC)
@@ -39,7 +39,7 @@ use serde::{Deserialize, Serialize};
3939
///
4040
/// * [Rate of Change, Wikipedia](https://en.wikipedia.org/wiki/Momentum_(technical_analysis))
4141
///
42-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
42+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4343
#[derive(Debug, Clone)]
4444
pub struct RateOfChange {
4545
length: u32,

‎src/indicators/relative_strength_index.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33
use crate::errors::*;
44
use crate::indicators::ExponentialMovingAverage as Ema;
55
use crate::{Close, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// The relative strength index (RSI).
@@ -68,7 +68,7 @@ use serde::{Deserialize, Serialize};
6868
/// * [Relative strength index (Wikipedia)](https://en.wikipedia.org/wiki/Relative_strength_index)
6969
/// * [RSI (Investopedia)](http://www.investopedia.com/terms/r/rsi.asp)
7070
///
71-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
71+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
7272
#[derive(Debug, Clone)]
7373
pub struct RelativeStrengthIndex {
7474
n: u32,

‎src/indicators/simple_moving_average.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt;
22

33
use crate::errors::*;
44
use crate::{Close, Next, Reset};
5-
#[cfg(feature = "serde_support")]
5+
#[cfg(feature = "serde")]
66
use serde::{Deserialize, Serialize};
77

88
/// Simple moving average (SMA).
@@ -38,7 +38,7 @@ use serde::{Deserialize, Serialize};
3838
///
3939
/// * [Simple Moving Average, Wikipedia](https://en.wikipedia.org/wiki/Moving_average#Simple_moving_average)
4040
///
41-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
41+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4242
#[derive(Debug, Clone)]
4343
pub struct SimpleMovingAverage {
4444
length: u32,

‎src/indicators/slow_stochastic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33
use crate::errors::Result;
44
use crate::indicators::{ExponentialMovingAverage, FastStochastic};
55
use crate::{Close, High, Low, Next, Reset};
6-
#[cfg(feature = "serde_support")]
6+
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88

99
/// Slow stochastic oscillator.
@@ -28,7 +28,7 @@ use serde::{Deserialize, Serialize};
2828
/// assert_eq!(stoch.next(30.0).round(), 31.0);
2929
/// assert_eq!(stoch.next(55.0).round(), 77.0);
3030
/// ```
31-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
31+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
3232
#[derive(Clone, Debug)]
3333
pub struct SlowStochastic {
3434
fast_stochastic: FastStochastic,

‎src/indicators/standard_deviation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt;
22

33
use crate::errors::*;
44
use crate::{Close, Next, Reset};
5-
#[cfg(feature = "serde_support")]
5+
#[cfg(feature = "serde")]
66
use serde::{Deserialize, Serialize};
77

88
/// Standard deviation (SD).
@@ -38,7 +38,7 @@ use serde::{Deserialize, Serialize};
3838
///
3939
/// * [Standard Deviation, Wikipedia](https://en.wikipedia.org/wiki/Standard_deviation)
4040
///
41-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
41+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4242
#[derive(Debug, Clone)]
4343
pub struct StandardDeviation {
4444
n: u32,

‎src/indicators/true_range.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt;
22

33
use crate::helpers::max3;
44
use crate::{Close, High, Low, Next, Reset};
5-
#[cfg(feature = "serde_support")]
5+
#[cfg(feature = "serde")]
66
use serde::{Deserialize, Serialize};
77

88
/// The range of a day's trading is simply _high_ - _low_.
@@ -49,7 +49,7 @@ use serde::{Deserialize, Serialize};
4949
/// }
5050
/// }
5151
/// ```
52-
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
52+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5353
#[derive(Debug, Clone)]
5454
pub struct TrueRange {
5555
prev_close: Option<f64>,

‎src/traits.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(feature = "serde_support")]
1+
#[cfg(feature = "serde")]
22
use serde::{de::DeserializeOwned, Serialize};
33

44
// Indicator traits
@@ -18,13 +18,13 @@ pub trait Reset {
1818
/// [MACD](indicators/struct.MovingAverageConvergenceDivergence.html) it is `(f64, f64, f64)` since
1919
/// MACD returns 3 values.
2020
///
21-
#[cfg(feature = "serde_support")]
21+
#[cfg(feature = "serde")]
2222
pub trait Next<T>: Serialize + DeserializeOwned {
2323
type Output;
2424
fn next(&mut self, input: T) -> Self::Output;
2525
}
2626

27-
#[cfg(not(feature = "serde_support"))]
27+
#[cfg(not(feature = "serde"))]
2828
pub trait Next<T> {
2929
type Output;
3030
fn next(&mut self, input: T) -> Self::Output;

‎tests/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extern crate ta;
55

66
#[cfg(test)]
77
mod test {
8-
#[cfg(feature = "serde_support")]
8+
#[cfg(feature = "serde")]
99
mod serde {
1010
use ta::indicators::SimpleMovingAverage;
1111
use ta::Next;

0 commit comments

Comments
 (0)