A position (finance) definition that has some good algebraic properties.

Related tags

Math positions
Overview

Positions

A position (finance) definition with some good algebraic properties.

Crates.io MIT licensed Build Status

API Docs

Example

Add positions as a dependency of your project.

[dependencies]
positions = "0.1"

# `rust_decimal` is added to make the example code work,
# but optional for using `positions`.
rust_decimal = "1.17.0"
rust_decimal_macros = "1.17.0"

And then, you can try these codes.

use positions::normal;
use rust_decimal_macros::dec;

let h1 = normal((dec!(1.0), dec!(2.0)));
let h2 = normal((dec!(2.0), dec!(3.0)));
let h3 = normal((dec!(1.5), dec!(-4.0)));

assert_eq!(h1 + h2 + h3, normal((dec!(1.6), dec!(1.0), dec!(-0.4))));
You might also like...
Statically sized matrix using a definition with const generics

Statically sized matrix using a definition with const generics

Event-sourcing Schema Definition Language

ESDL Event-sourcing Schema Definition Language Schema definition language for defining aggregates, commands, events & custom types. Heavily inspired b

Interface definition generator and standard for Move packages.

Move IDL Interface definition generator and standard for Move packages. Documentation is currently extremely sparse but will be improved in the near f

Small program which groups images based on the GPS position.

gps-cluster This small program will take some pictures in input, and based on the metadata on every image, it will group them by their GPS position, i

A lightweight platform-accelerated library for biological motif scanning using position weight matrices.

🎼 🧬 lightmotif A lightweight platform-accelerated library for biological motif scanning using position weight matrices. 🗺️ Overview Motif scanning

2D and 3D physics engine based on Extended Position Based Dynamics for Bevy.

Bevy XPBD Bevy XPBD is a 2D and 3D physics engine based on Extended Position Based Dynamics (XPBD) for the Bevy game engine. Design Below are some of

Rusty Shellcode Reflective DLL Injection (sRDI) - A small reflective loader in Rust 4KB in size for generating position-independent code (PIC) in Rust.
Rusty Shellcode Reflective DLL Injection (sRDI) - A small reflective loader in Rust 4KB in size for generating position-independent code (PIC) in Rust.

Shellcode Reflective DLL Injection (sRDI) Shellcode reflective DLL injection (sRDI) is a process injection technique that allows us to convert a given

💫 List-rendering component utilizing FLIP position transitions for Leptos
💫 List-rendering component utilizing FLIP position transitions for Leptos

AnimatedFor / component for Leptos FLIP animations for element and component groups inspired by Vue's TransitionGroup. This crate exports a compon

Serde definition of Cargo.toml structure

Deserialize Cargo.toml This is a definition of fields in Cargo.toml files for serde. It allows reading of Cargo.toml data, and serializing it using TO

Rust library to create a Good Game Easily

ggez What is this? ggez is a Rust library to create a Good Game Easily. The current version is 0.6.0-rc0. This is a RELEASE CANDIDATE version, which m

Smart contracts for Ref Finance

Ref Finance Contracts This mono repo contains the source code for the smart contracts of Ref Finance on NEAR. Contracts Contract Reference Description

Parallel finance a decentralized lending protocol built on top of the Polkadot ecosystem. Our unique approach will allow users to earn
Parallel finance a decentralized lending protocol built on top of the Polkadot ecosystem. Our unique approach will allow users to earn "double interests" from staking and lending their tokens simultaneously.

Parallel Finance A new Cumulus-based Substrate node, ready for hacking 🚀 Getting Started Follow these steps to get started with the Cumulus Template

Rust library to create a Good Game Easily

ggez What is this? ggez is a Rust library to create a Good Game Easily. The current version is 0.6.0-rc0. This is a RELEASE CANDIDATE version, which m

Skyward Finance smart-contracts

Build and Init ./build.sh near dev-deploy res/skyward.was export CONTRACT_ID=skyward.testnet near call $CONTRACT_ID new --account_id=$CONTRACT_ID Regi

Zopfli Compression Algorithm is a compression library programmed in C to perform very good, but slow, deflate or zlib compression.

Zopfli Compression Algorithm is a compression library programmed in C to perform very good, but slow, deflate or zlib compression.

nAssets are Nova Finance’s framework for building programmable assets.
nAssets are Nova Finance’s framework for building programmable assets.

nAssets are Nova Finance’s framework for building programmable assets. nAssets can be used to tokenize and store collective forms of value while also instructing assets to yield, exchange or rebalance.

AMCOS - A high-peformance parallel monte-carlo simulation for estimating the fair value of options in finance

antoons-monte-carlo-options-sim A high-peformance parallel monte-carlo simulation for estimating the fair value of options in finance. Written in Rust

Fls - Ferris-LS, a very bad LS replacement. Besides that, proves that I suck at clean & good code.

FLS A handy ls remake, purely for learning. Why FLS? There's no reason, at all, don't use it. I just want to learn Rust :D Usage Flags: -i = Use icons

Rails for realtime finance on Solana.✌️
Rails for realtime finance on Solana.✌️

venko ✌️ Venko: Rails for realtime finance on Solana. About Venko is a protocol for issuing streams of tokens. It is designed for a variety of usecase

Comments
  • Add a `Symbol` type to identify `Instrument`

    Add a `Symbol` type to identify `Instrument`

    The current Hash implementation only hashes Instrument::symbol, which is good that we can use &str to query a Instrument in a hash map. But there are cases that different instruments sharing the same symbol, we should be able to support them.

    v0.2 
    opened by Nouzan 1
Releases(v0.2.1)
  • v0.2.1(Dec 3, 2022)

    What's Changed

    • Implement PositionTree for multi-assets positions calculation by @Nouzan in https://github.com/Nouzan/positions/pull/1
    • tree: introduce StrongeWeakTree by @Nouzan in https://github.com/Nouzan/positions/pull/2
    • Add reversed-form support to Asset && PositionTree by @Nouzan in https://github.com/Nouzan/positions/pull/3
    • Implement the tree evaluation by @Nouzan in https://github.com/Nouzan/positions/pull/4
    • Implement AddAssign for NaivePosition by @Nouzan in https://github.com/Nouzan/positions/pull/5
    • A new design of Position and PositionTree by @Nouzan in https://github.com/Nouzan/positions/pull/6
    • tree: add eval_with by @Nouzan in https://github.com/Nouzan/positions/pull/7
    • use an enum to represent a symbol by @Nouzan in https://github.com/Nouzan/positions/pull/11
    • add Expr for evaluation by @Nouzan in https://github.com/Nouzan/positions/pull/12
    • Release v0.2.0 by @Nouzan in https://github.com/Nouzan/positions/pull/10

    New Contributors

    • @Nouzan made their first contribution in https://github.com/Nouzan/positions/pull/1

    Full Changelog: https://github.com/Nouzan/positions/compare/v0.1.0...v0.2.1

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0-rc.3(Nov 27, 2022)

    What's Changed

    • Implement PositionTree for multi-assets positions calculation by @Nouzan in https://github.com/Nouzan/positions/pull/1
    • tree: introduce StrongeWeakTree by @Nouzan in https://github.com/Nouzan/positions/pull/2
    • Add reversed-form support to Asset && PositionTree by @Nouzan in https://github.com/Nouzan/positions/pull/3
    • Implement the tree evaluation by @Nouzan in https://github.com/Nouzan/positions/pull/4
    • Implement AddAssign for NaivePosition by @Nouzan in https://github.com/Nouzan/positions/pull/5
    • A new design of Position and PositionTree by @Nouzan in https://github.com/Nouzan/positions/pull/6
    • tree: add eval_with by @Nouzan in https://github.com/Nouzan/positions/pull/7

    New Contributors

    • @Nouzan made their first contribution in https://github.com/Nouzan/positions/pull/1

    Full Changelog: https://github.com/Nouzan/positions/compare/v0.1.0...v0.2.0-rc.3

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Nov 1, 2021)

Owner
Nouzan
Nouzan
Parser for Object files define the geometry and other properties for objects in Wavefront's Advanced Visualizer.

format of the Rust library load locad blender obj file to Rust NDArray. cargo run test\t10k-images.idx3-ubyte A png file will be generated for the fi

Nasser Eddine Idirene 1 Jan 3, 2022
Messing around with delimited continuations, fibers, and algebraic effects

A Simple Virtual Machine with Effects Each thread of execution in this VM is called a Fiber. A Fiber is unique, can be sent between threads, but can n

Isaac Clayton 8 Jun 23, 2022
An implementation of a predicative polymorphic language with bidirectional type inference and algebraic data types

Vinilla Lang Vanilla is a pure functional programming language based on System F, a classic but powerful type system. Merits Simple as it is, Vanilla

Zehao Chen 73 Aug 4, 2022
Algebraic structures, higher-kinded types and other category theory bad ideas

Algar Algebric structures, higher-kinded types and other category theory bad ideas. Yes, you'll have generalized functors, applicatives, monads, trave

Stefano Candori 3 Jan 31, 2023
Zero-grammer definition command-line parser

zgclp Zgclp (Zero-grammar definition command-line parser) is one of Rust's command-line parsers. A normal command-line parser generates a parser from

Toshihiro Kamiya 1 Mar 31, 2022
Calculates a stars position and velocity in the cartesian coordinate system.

SPV Calculates a stars position and velocity in the cartesian coordinate system. Todo Expand the number of available operation Batch processing by tak

Albin Sjögren 11 Feb 18, 2022
An experimental IPC interface definition language for Hubris.

Idol: interface definitions for Hubris This is an experimental interface definition language for defining IPC interfaces between tasks in a Hubris app

Oxide Computer Company 8 Oct 19, 2022
A small Rust library that let's you get position and size of the active window on Windows and MacOS

active-win-pos-rs A small Rust library that let's you get position and size of the active window on Windows and MacOS Build % git clone https://github

Dmitry Malkov 21 Jan 6, 2023
Dade is data definition for Rust structures.

dade dade is data definition for Rust structures. For the easy handle of data, the following will support it. Data validation. Data schema conforms Js

odd 3 May 1, 2022
Drop ownership from "method position"

disown Drop ownership from "method position". Motivation Normally, unowned data is automatically dropped at the end of its residing block. We can also

Colin Woodbury 2 Mar 9, 2022