Skip to content

Facade #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ It would be nice to have screenshot or result image uploaded
Some minimal reproduce code is highly recommended

**Version Information**
Please give us what version you are using. If you are pulling `Plotters` directly from git repo, please mention this as well
Please give us what version you are using. If you are pulling `UX Indicators` directly from git repo, please mention this as well
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Feature request
about: Suggest an idea to Plotter maintainers
about: Suggest an idea to UX Indicators maintainers
title: "[Feature Request]"
labels: feature request
assignees: ''
Expand Down
9 changes: 9 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
comment:
layout: "diff, flags, files"
require_changes: true

coverage:
status:
project:
default:
informational: true
17 changes: 17 additions & 0 deletions .github/workflows/audit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Security audit
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '0 0 * * 0'

jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
49 changes: 49 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Coverage

#on:
# push:
# branches:
# - main
# pull_request:

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
default: true

- name: Restore cache
uses: Swatinem/rust-cache@v1

- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]
with:
args: '--all-features --run-types Doctests,Tests'
timeout: 120

- name: Upload to codecov.io
uses: codecov/codecov-action@239febf655bba88b16ff5dea1d3135ea8663a1f9
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: cobertura.xml
retention-days: 30
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tests

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

clippy_check:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ maintenance = { status = "actively-developed" }
name = "indicators"

[dependencies]
serde = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_derive = "1.0"
lazy_static = "1.4"
Expand All @@ -43,7 +43,7 @@ cucumber_rust = "0.6"
# cucumber = "0.3.1"


[[bench]]
name = "indicators"
path = "benches/indicators.rs"
harness = false
# [[bench]]
# name = "indicators"
# path = "benches/indicators.rs"
# harness = false
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# UX Indicators

<div align="center">

[![](https://dudochkin-victor.github.io/assets/ux-indicators/logo-wide.svg)](#top)
# UX Indicators

[![API Docs][docrs-badge]][docrs-url]
[![Crates.io][crates-badge]][crates-url]
[![Code coverage][codecov-badge]][codecov-url]
[![Tests][tests-badge]][tests-url]
[![MPL-2.0 licensed][license-badge]][license-url]
[![Gitter chat][gitter-badge]][gitter-url]
[![Rustc Version 1.45+][rust-badge]][rust-url]
[![loc][loc-badge]][loc-url]
</div>

Expand All @@ -16,17 +18,23 @@
[crates-url]: https://crates.io/crates/ux-indicators
[license-badge]: https://img.shields.io/badge/license-MPL--2.0-blue.svg?style=flat-square
[license-url]: https://github.com/angular-rust/ux-indicators/blob/master/LICENSE
[gitter-badge]: https://img.shields.io/gitter/room/angular_rust/angular_rust.svg?style=flat-square
[gitter-badge]: https://img.shields.io/gitter/room/angular_rust/community.svg?style=flat-square
[gitter-url]: https://gitter.im/angular_rust/community
[rust-badge]: https://img.shields.io/badge/rustc-1.45-lightgrey.svg?style=flat-square
[rust-url]: https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html
[loc-badge]: https://tokei.rs/b1/github/angular-rust/ux-indicators?category=code
[tests-badge]: https://img.shields.io/github/workflow/status/angular-rust/ux-indicators/Tests?label=tests&logo=github&style=flat-square
[tests-url]: https://github.com/angular-rust/ux-indicators/actions/workflows/tests.yml
[codecov-badge]: https://img.shields.io/codecov/c/github/angular-rust/ux-indicators?logo=codecov&style=flat-square&token=M517IMMA0L
[codecov-url]: https://codecov.io/gh/angular-rust/ux-indicators
[loc-badge]: https://img.shields.io/tokei/lines/github/angular-rust/ux-indicators?style=flat-square
[loc-url]: https://github.com/angular-rust/ux-indicators

ux-indicators is a Centralized State Management And Design Patterns for Rust.
**UX Indicators** is a Rust library for technical analysis in Angular Rust. It provides a range of technical indicators that can be used to build trading strategies for stock markets, futures, forex, cryptocurrencies, and more.

> **work in progress**

**Angular Rust** is a high productivity, `platform-agnostic` frontend framework for the [Rust language](https://www.rust-lang.org/). It now supports desktop and web development. Angular Rust currently uses GTK for desktop development and WebAssembly for web development. We are planning to add support for mobile development.

![Angular Rust structure](https://dudochkin-victor.github.io/assets/angular-rust/structure.svg)

## Features

- [x] Graphic abstraction for cairo and web canvas, implemented in [UX Animate](https://github.com/angular-rust/ux-animate)
Expand Down Expand Up @@ -58,7 +66,7 @@ Install UX Indicators:

We believe the wider community can create better code. The first tool for improving the community is to tell the developers about the project by giving it a star. More stars - more members.

![Star a repo](https://dudochkin-victor.github.io/assets/star-me-wide.svg)
[![](https://dudochkin-victor.github.io/assets/star-me-wide.svg)](https://github.com/angular-rust/ux-indicators#top)

Angular Rust is a community effort and we welcome all kinds of contributions, big or small, from developers of all backgrounds. We want the Angular Rust community to be a fun and friendly place, so please review our [Code of Conduct](CODE_OF_CONDUCT.md) to learn what behavior will not be tolerated.

Expand Down
File renamed without changes.
8 changes: 2 additions & 6 deletions examples/ema.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
extern crate csv;
extern crate core;
extern crate csv;

use indicators::{
indicators::ExponentialMovingAverage as Ema,
DataItem,
Next
};
use indicators::{indicators::ExponentialMovingAverage as Ema, DataItem, Next};

fn main() {
let mut ema = Ema::new(9).unwrap();
Expand Down
46 changes: 24 additions & 22 deletions src/data_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,30 @@ use crate::traits::{Close, High, Low, Open, Volume};

/// Data item is used as an input for indicators.
///
/// # Example
///
/// ```
/// use core::DataItem;
/// use core::{Open, High, Low, Close, Volume};
///
/// let item = DataItem::builder()
/// .open(20.0)
/// .high(25.0)
/// .low(15.0)
/// .close(21.0)
/// .volume(7500.0)
/// .build()
/// .unwrap();
///
/// assert_eq!(item.open(), 20.0);
/// assert_eq!(item.high(), 25.0);
/// assert_eq!(item.low(), 15.0);
/// assert_eq!(item.close(), 21.0);
/// assert_eq!(item.volume(), 7500.0);
/// ```
///

// # Example
//
// ```
// use core::DataItem;
// use core::{Open, High, Low, Close, Volume};
//
// let item = DataItem::builder()
// .open(20.0)
// .high(25.0)
// .low(15.0)
// .close(21.0)
// .volume(7500.0)
// .build()
// .unwrap();
//
// assert_eq!(item.open(), 20.0);
// assert_eq!(item.high(), 25.0);
// assert_eq!(item.low(), 15.0);
// assert_eq!(item.close(), 21.0);
// assert_eq!(item.volume(), 7500.0);
// ```
//

#[derive(Debug, Clone)]
pub struct DataItem {
open: f64,
Expand Down
Loading