blankenshipz / oanda-rs Goto Github PK
View Code? Open in Web Editor NEWRust wrapper for the Oanda Rest API
License: MIT License
Rust wrapper for the Oanda Rest API
License: MIT License
Finish the account endpoint
GET:
/accounts/{AccountID}/summary
/accounts/{AccountID}/instruments
/accounts/{AccountID}/changes
PATCH:
/accounts/{AccountID}/configuration
The current version of details.rs
is a bit lengthy, consider moving some structs/enums to their own files.
Per #7 update the README
to address the needs for setting up the test environment:
.secrets
file that is read by docker-compose
.The .secrets
file should contain:
OANDA_API_KEY=<hex>
# Note that the OANDA_API_URL contains the version
OANDA_API_URL=https://api-fxpractice.oanda.com/v3
OANDA_TEST_ACCOUNT_ID=<the oanda account to use that the token has access to>
Oanda
practice account and name it "TestV20"I have the same problem as reported previously. The old version 0.4.1 is correctly specified in Cargo.toml but when compiling it always pulls in the latest version, currently 0.4.4, which then causes compilation errors. I do not understand it. Maybe Cargo demands some override to insist on obsolete packages? So much for the fabled Cargo simplicity ...
Setup CI with CircleCI - there are some tests
Fetch Candlestick data for an instrument
I can not get any of the tests to pass. I have read the issue "Error when running..." and I understand that I "have to name" the account Testv20. However, Oanda does not let me change the name of the primary account from Primary. I have created a sub account and given it this name and put in .secrets the new account number but all the tests still fail.
docker-compose run --rm lib
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
docker --version
Docker version 17.05.0-ce, build 89658be
After changing the version to 2.0 I can run the container. The tests fail though. I think it is because the environment variables might no be present. In the docker-compose.yml
there is a reference to .secrets
so I created that file and put the following inside:
OANDA_API_URL=https://api-fxpractice.oanda.com
OANDA_API_KEY=<key from the site in hex format>
Is that the right way?
The output after running the container:
running 5 tests
thread 'thread 'account::tests::it_can_read_account_detailsclient::tests::it_can_read_accounts' panicked at '' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresentcalled `Result::unwrap()` on an `Err` value: NotPresent', ', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs/buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs::thread '868868account::tests::it_can_read_account_instruments
note: Run with `RUST_BACKTRACE=1` for a backtrace.
' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresent', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rsthread ':instrument::pricing_query::tests::it_can_perform_a_query868' panicked at '
called `Result::unwrap()` on an `Err` value: NotPresent', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rsthread ':account::tests::it_can_read_account_summary868' panicked at '
called `Result::unwrap()` on an `Err` value: NotPresent', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs:868
test account::tests::it_can_read_account_details ... FAILED
test account::tests::it_can_read_account_instruments ... FAILED
test account::tests::it_can_read_account_summary ... FAILED
test instrument::pricing_query::tests::it_can_perform_a_query ... FAILED
test client::tests::it_can_read_accounts ... FAILED
failures:
failures:
account::tests::it_can_read_account_details
account::tests::it_can_read_account_instruments
account::tests::it_can_read_account_summary
client::tests::it_can_read_accounts
instrument::pricing_query::tests::it_can_perform_a_query
test result: FAILED. 0 passed; 5 failed; 0 ignored; 0 measured
Compilation fails due to no Ratelimit struct in ratelimit crate.
Checked ratelimit docs for version 0.4.3 but there is not a Ratelimit struct, they use a builder.
Consider a simple token bucket strategy:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.