Closed wasabi-peanutz closed 3 years ago
What is the ticker?
AMZN GE SPY TLSA
Tried many...
Can you try these links directly and see if they resolve?
https://query1.finance.yahoo.com/v8/finance/chart/AMZN?range=1d&interval=1m&includePrePost=true https://query1.finance.yahoo.com/v8/finance/chart/SPY?range=1d&interval=1m&includePrePost=true https://query1.finance.yahoo.com/v10/finance/quoteSummary/AMZN?modules=price,assetProfile https://query1.finance.yahoo.com/v10/finance/quoteSummary/SPY?modules=price,assetProfile
I just noticed you're trying to run this from an Android phone... I have NO idea if the aarch64-unknown-linux-gnu
binary would work there. I'm pretty sure I'd have to target aarch64-linux-android
specifically to get things working 100%, but I haven't really ever looked into this.
Here's a version I built for android, test this out and let me know if it works
Thanks for all the support.
The URLs load fine. I tried curl from the (termux) shell to retrieve w/ no issues.
I had tried the aarch64-unknown-linux-gnu binary previously but it did not run on this hardware.
Thanks for the binary. It runs. However, it has the same "..." indefintely w/ no chart loading. (Same issue as noted in the original post.) The rest of the program runs properly (renders, keyboard commands, etc).
I should note originally - I did build for android via the "cargo install tickrs". It compiles &builds completely on my setup. However, it has the same results as the version you compiled.
Where to go from here? How can we extract some debug info? Is there helpful switches for build output information or debug hooks we could put in the source?
Let me know how to continue to debug and help. I am anxious to use this and help pave the way for all android termux users.
Yeah, lets get this figured out! It's got to be one of the dependencies that "compiles" properly for that target, but doesn't work. My guess would be the curl dependency I use, isahc
. Let's start by researching that dependency and any sub-deps of that to make sure it all supports the aarch64-linux-android
target.
As far as debugging... I have 0 debug lines or logging anywhere in the program currently. We can pepper in some, disable the raw mode I set the terminal in, and disable drawing the UI so we can just see the output of those messages. I'm 99% sure it's networking related and probably due to the isahc
/ static curl that is built not working properly. But some debug messages around that would definitely help.
https://github.com/tarkah/tickrs/blob/ab76c6bde42bf4799b99b112ecc6d27ebe0ed082/src/main.rs#L119 https://github.com/tarkah/tickrs/blob/ab76c6bde42bf4799b99b112ecc6d27ebe0ed082/src/main.rs#L130 https://github.com/tarkah/tickrs/blob/ab76c6bde42bf4799b99b112ecc6d27ebe0ed082/src/main.rs#L198
https://github.com/tarkah/tickrs/blob/ab76c6bde42bf4799b99b112ecc6d27ebe0ed082/src/task/prices.rs#L41-L44 https://github.com/tarkah/tickrs/blob/ab76c6bde42bf4799b99b112ecc6d27ebe0ed082/src/task/company.rs#L34 https://github.com/tarkah/tickrs/blob/ab76c6bde42bf4799b99b112ecc6d27ebe0ed082/src/task/current_price.rs#L33
Another thought.... you can also run cargo test --target aarch64-linux-android --workspace -- --nocapture
and I have some tests in the API
crate that do http requests. You can see if that succeeds or not.
You can also try removing the static curl / static openssl that gets built and see if linked one works:
Change this:
To this:
curl = { version = "0.4" }
isahc = { version = "0.8", default-features = false, features = ["http2", "text-decoding"] }
So I added some debugging and I'm getting the following error:
BadClientCertificate(None)
so I don't think there are ssl certs installed w/ termux so the ssl/tls requests are failing. Let me see if there's an easy fix for this.
I think we need a way to specify the openssl directory so it can find the certs shipped with termux
$TERMUX_PREFIX/etc/tls
It works!
I disabled ssl cert validation, I didn't know how to fix it otherwise... Don't think there is really much of a risk here, plus it'll only be disabled for Android.
diff --git a/api/src/client.rs b/api/src/client.rs
index 069aeb1..ed9dbfb 100644
--- a/api/src/client.rs
+++ b/api/src/client.rs
@@ -3,7 +3,7 @@ use std::collections::HashMap;
use anyhow::{bail, Context, Result};
use futures::AsyncReadExt;
use http::Uri;
-use isahc::HttpClient;
+use isahc::prelude::*;
use serde::de::DeserializeOwned;
use crate::model::{Chart, ChartData, Company, CompanyData, Options, OptionsHeader};
@@ -182,7 +182,17 @@ impl Client {
impl Default for Client {
fn default() -> Client {
- let client = HttpClient::new().unwrap();
+ #[allow(unused_mut)]
+ let mut builder = HttpClient::builder();
+
+ #[cfg(target_os = "android")]
+ {
+ use isahc::config::SslOption;
+
+ builder = builder.ssl_options(SslOption::DANGER_ACCEPT_INVALID_CERTS);
+ }
+
+ let client = builder.build().unwrap();
let base = String::from("https://query1.finance.yahoo.com");
Can you build from #119 and confirm it works for you? If so, I'll merge and start releasing w/ android binaries
This is so awesome... May need to use this as an alternative screen now.
Using termux styling, font Fantasque looks best with no spacing between braille characters.
Actually, terminus
is the best for charting as it doesn't seem to have horizontal spacing either, its very even.
And in summary mode, scrolling up / down with your finger works with the scrolling feature there! So nice :D
~ $ cargo install --git https://github.com/tarkah/tickrs --branch android-support
Successful build and it works!
...and how beautiful of a thing on mobile, ssh session, or a terminal in dex mode. 😃 👍
Thank you so much.
Now back to losing money in the market...
Issue: After "add a ticker" with a valid ticker it just repeats "..." indefinitely and never loads the chart. The rest of the key commands and the tui app all appear to work fine.
Install: cargo install tickrs
System info:
$ cargo -V cargo 1.50.0
$ uname -a Linux localhost 4.14.113-20606106 #1 SMP PREEMPT Mon Feb 1 10:40:43 KST 2021 aarch64 Android
$ termux-info Packages CPU architecture: aarch64 Android version: 11 Device manufacturer: samsung Device model: SM-N975F
Thanks for any support you can provide!