-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements APIs to get WSH event data (#152)
- Loading branch information
Showing
9 changed files
with
433 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use ibapi::Client; | ||
|
||
// This example demonstrates requesting Wall Street Horizon event data by contract ID. | ||
|
||
fn main() { | ||
env_logger::init(); | ||
|
||
let client = Client::connect("127.0.0.1:4002", 100).expect("connection failed"); | ||
|
||
let contract_id = 76792991; // TSLA | ||
let start_date = None; | ||
let end_date = None; | ||
let limit = None; | ||
let auto_fill = None; | ||
|
||
let event_data = client | ||
.wsh_event_data_by_contract(contract_id, start_date, end_date, limit, auto_fill) | ||
.expect("request wsh event data failed"); | ||
|
||
println!("{}", event_data.data_json); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use ibapi::Client; | ||
|
||
// This example demonstrates requesting Wall Street Horizon event data by filter. | ||
// This featured does not appear to be released yet. | ||
|
||
fn main() { | ||
env_logger::init(); | ||
|
||
let client = Client::connect("127.0.0.1:4002", 100).expect("connection failed"); | ||
|
||
let filter = ""; // filter as JSON string. | ||
|
||
let subscription = client | ||
.wsh_event_data_by_filter(filter, None, None) | ||
.expect("request wsh event data failed"); | ||
|
||
for event_data in subscription { | ||
println!("{:?}", event_data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use ibapi::Client; | ||
|
||
// This example demonstrates requesting Wall Street Horizon metadata. | ||
|
||
fn main() { | ||
env_logger::init(); | ||
|
||
let client = Client::connect("127.0.0.1:4002", 100).expect("connection failed"); | ||
|
||
let metadata = client.wsh_metadata().expect("request wsh metadata failed"); | ||
println!("{}", metadata.data_json); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.