Skip to content

Commit

Permalink
v0.4.0 (#24)
Browse files Browse the repository at this point in the history
* Refactor Into Endpoint Enum, remove docs

* continued refactoring to use request::Endpoint

* updated Readme

* Update param Movers

* added models, cleanup of docs

* Cleanup of documents

* updated documentation and readme

* added docs for github.io
  • Loading branch information
jbertovic authored Sep 28, 2021
1 parent 06ef374 commit 9d3854c
Show file tree
Hide file tree
Showing 151 changed files with 3,501 additions and 2,395 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tdameritradeclient"
version = "0.3.1"
version = "0.4.0"
authors = ["Jas Bertovic <[email protected]>"]
edition = "2018"

Expand Down
10 changes: 9 additions & 1 deletion Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# v0.4.0
- Major change in approach of making requests. Requests are now made from an enum of endpoints instead of individual unique functions on client for each endpoint.
- added generic requests on client; `get`, `post`, `put`, `patch` and `delete`
- removed endpoint funtions from `TDClient` which will prevent backward compatibility to version 0.3
- caputured endpoints in `request` module
- updated documentation, examples, and tests with new approach
- added model types for `SecuritiesAccount` and `UserPrincipals` response

# v0.3.1
- added derive(Default) on TDClient
- added `derive(Default)` on `TDClient`

# v0.3.0
- add log crate and inserted a few log outputs for ERROR and INFO
Expand Down
51 changes: 13 additions & 38 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
**Disclaimer:** I'm not endorsing and am not affiliated with TD Ameritrade. Be careful using the API and understand that actual orders can be created through this library. Read and understand the TD Ameritrade's api terms of service and documentation before using.

# Version 0.4 Changes

I changed my approach to this wrapper around TD Ameritrade's API. Previous versions used multiple functions on the client to specify each endpoint. This version has a major change in that it specifies the endpoints in the request module as an Endpoint enum. So now both the parameters for query parameters and specifying the endpoints are kept in enums. I have updated the examples to show how to use them. This change will break backward compatibility to previous versions. Feedback is welcomed.

I added a model module to contain response types that can be parsed from the json output. I tried using TD Ameritrade Schema's that were located on their developer site, however, they don't always match or there is additional data available. Therefore, I'm creating these response type's manually - experimenting a bit. Would be much more useful if there was a way to code generate the types that match each response. Its your option if you want to use them, or stick with json or define your own response types.

# tdameritradeclient

[Documentation](https://jbertovic.github.io/tdameritradeclient/doc/tdameritradeclient/)
[Documentation](https://jbertovic.github.io/tdameritradeclient/doc/tdameritradeclient/index.html)

## Description

Expand All @@ -21,7 +26,7 @@ For the examples and tests to work you will need to set environmental variables

```
use std::env;
use tdameritradeclient::TDAClient;
use tdameritradeclient::{TDAClient, Endpoint, param};
// Will need to set TDAUTHTOKEN as environmental variable containing a valid token
Expand All @@ -34,7 +39,7 @@ fn main() {
let c = TDAClient::new(token);
// get quotes for 3 symbols and execute
let resptxt: String = c.get_quotes("F,INTC,TRP");
let resptxt: String = c.get(&Endpoint::Quotes, &[param::Quotes::Symbol("F,SPY,INTC,IWM")]);
// output will be text string in json format
println!("{:?}", resptxt);
Expand All @@ -44,7 +49,7 @@ fn main() {

## Setup

You will need to determine a way to supply a method of authorization to the client.
You will need to determine a way to supply a method of authorization to the client. The client is simple and will only take a valid token to perform the requests. The client will not automatically manage the token refresh. See `auth` module below.

You can implement the client in one of 3 ways:
1) Supply valid ***token*** that will be used in the request as `Bearer <token>`
Expand All @@ -55,7 +60,7 @@ See [developer.tdameritrade.com](http://developer.tdameritrade.com) on how to ma

## Authorization module

I've included some utility tools under `auth` module to help deal with managing tokens using the above 3 options. See documentation for extra information.
I've included utility tools under `auth` module to help deal with managing tokens using the above 3 options. See documentation for extra information.

Example using `refresh_token` to renew `token`

Expand Down Expand Up @@ -83,38 +88,8 @@ clientid: "[email protected]", redirecturi: None }


## Future IDEAS
- [ ] build json schema for order types to help when creating new orders or replacing existing orders
- [X] add log crate
- [ ] create model structs for all json output
- [ ] continue to add documentation
- [ ] add better error checking on `Execute<T>` Trait and creating/deleting/changing orders
- [ ] add better error checking on `Execute<T>` Trait
- [ ] create feature option from serde_json
- [ ] build structs that match json return structures


## Endpoints added
see [https://developer.tdameritrade.com/apis](http://developer.tdameritrade.com/apis)

- [X] GET /userprincipals
- [ ] GET /userprincipals?parameters*
- [ ] GET /userprincipals/streamersubscriptionkeys
- [X] GET /marketdata/quotes?symbol
- [X] GET /marketdata/{}/hours
- [X] GET /marketdata/{}/hours?date
- [X] GET /marketdata/{}/pricehistory
- [X] GET /marketdata/chains
- [X] GET /accounts/{}
- [X] GET /accounts/{}/watchlists
- [X] GET /accounts/{}?parameters*
- [X] GET /accounts/{}/orders?parameters*
- [X] GET /accounts/{}/transactions?parameters*
- [X] GET /accounts/{}/transactions/{}
- [X] GET /marketdata/{}/pricehistory?parameters*
- [X] GET /marketdata/chains?parameters*
- [X] GET /instruments?parameters*
- [X] GET /instruments/{}
- [X] POST /accounts/{}/orders
- [X] PUT /accounts/{}/orders
- [X] DELETE /accounts/{}/orders
- [X] POST /oauth2/token

parameters* indicates that the fields are specified in the enums located in src/params.rs
- [ ] create schema structs in defining orders
Empty file modified doc/.lock
100755 → 100644
Empty file.
21 changes: 13 additions & 8 deletions doc/COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ These documentation pages include resources by third parties. This copyright
file applies only to those resources. The following third party resources are
included, and carry their own copyright notices and license terms:

* Fira Sans (FiraSans-Regular.woff, FiraSans-Medium.woff):
* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2,
FiraSans-Regular.woff, FiraSans-Medium.woff):

Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Sans.
Expand All @@ -23,7 +24,10 @@ included, and carry their own copyright notices and license terms:
Copyright (c) Nicolas Gallagher and Jonathan Neal.
Licensed under the MIT license (see LICENSE-MIT.txt).

* Source Code Pro (SourceCodePro-Regular.woff, SourceCodePro-Semibold.woff):
* Source Code Pro (SourceCodePro-Regular.ttf.woff2,
SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2,
SourceCodePro-Regular.ttf.woff, SourceCodePro-Semibold.ttf.woff,
SourceCodePro-It.ttf.woff):

Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark
Expand All @@ -32,14 +36,15 @@ included, and carry their own copyright notices and license terms:
Licensed under the SIL Open Font License, Version 1.1.
See SourceCodePro-LICENSE.txt.

* Source Serif Pro (SourceSerifPro-Regular.ttf.woff,
SourceSerifPro-Bold.ttf.woff, SourceSerifPro-It.ttf.woff):
* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2,
SourceSerif4-It.ttf.woff2, SourceSerif4-Regular.ttf.woff,
SourceSerif4-Bold.ttf.woff, SourceSerif4-It.ttf.woff):

Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/), with
Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of
Adobe Systems Incorporated in the United States and/or other countries.
Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name
'Source'. All Rights Reserved. Source is a trademark of Adobe in the United
States and/or other countries.

Licensed under the SIL Open Font License, Version 1.1.
See SourceSerifPro-LICENSE.txt.
See SourceSerif4-LICENSE.md.

This copyright file is intended to be distributed with rustdoc output.
4 changes: 2 additions & 2 deletions doc/FiraSans-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A.
with Reserved Font Name < Fira >,
with Reserved Font Name < Fira >,

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
Expand All @@ -19,7 +19,7 @@ with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
Expand Down
Binary file added doc/FiraSans-Medium.woff2
Binary file not shown.
Binary file added doc/FiraSans-Regular.woff2
Binary file not shown.
Binary file added doc/SourceCodePro-It.ttf.woff
Binary file not shown.
Binary file added doc/SourceCodePro-It.ttf.woff2
Binary file not shown.
Binary file added doc/SourceCodePro-Regular.ttf.woff
Binary file not shown.
Binary file added doc/SourceCodePro-Regular.ttf.woff2
Binary file not shown.
Binary file removed doc/SourceCodePro-Regular.woff
Binary file not shown.
Binary file added doc/SourceCodePro-Semibold.ttf.woff
Binary file not shown.
Binary file added doc/SourceCodePro-Semibold.ttf.woff2
Binary file not shown.
Binary file removed doc/SourceCodePro-Semibold.woff
Binary file not shown.
Binary file added doc/SourceSerif4-Bold.ttf.woff
Binary file not shown.
Binary file added doc/SourceSerif4-Bold.ttf.woff2
Binary file not shown.
Binary file added doc/SourceSerif4-It.ttf.woff
Binary file not shown.
Binary file added doc/SourceSerif4-It.ttf.woff2
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2014-2018 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.
Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.

This Font Software is licensed under the SIL Open Font License, Version 1.1.

Expand Down
Binary file added doc/SourceSerif4-Regular.ttf.woff
Binary file not shown.
Binary file added doc/SourceSerif4-Regular.ttf.woff2
Binary file not shown.
Binary file removed doc/SourceSerifPro-Bold.ttf.woff
Binary file not shown.
Binary file removed doc/SourceSerifPro-It.ttf.woff
Binary file not shown.
Binary file removed doc/SourceSerifPro-Regular.ttf.woff
Binary file not shown.
2 changes: 1 addition & 1 deletion doc/ayu.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/clipboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doc/crates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.ALL_CRATES = ["tdameritradeclient"];
2 changes: 1 addition & 1 deletion doc/dark.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions doc/implementors/core/clone/trait.Clone.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9d3854c

Please sign in to comment.