This commit is contained in:
Elijah McMorris 2023-06-19 22:04:13 +00:00 committed by NexVeridian
parent 1bfbbaa826
commit 0de1bcb725
Signed by: NexVeridian
SSH key fingerprint: SHA256:bsA1SKZxuEcEVHAy3gY1HUeM5ykRJl0U0kQHQn0hMg8
6 changed files with 26 additions and 17857 deletions

View file

@ -1,5 +1,9 @@
# [target.x86_64-unknown-linux-gnu] [target.x86_64-unknown-linux-gnu]
# rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/mold"] linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"]
[alias] [alias]
t = "nextest run" t = "nextest run"
[build]
target-dir = "target/target"

View file

@ -2,7 +2,7 @@
FROM mcr.microsoft.com/devcontainers/rust:bookworm FROM mcr.microsoft.com/devcontainers/rust:bookworm
RUN apt-get update && \ RUN apt-get update && \
apt install -y build-essential xz-utils musl-tools musl-dev gcc-multilib pkg-config libssl-dev mold apt install -y build-essential xz-utils musl-tools musl-dev gcc-multilib pkg-config libssl-dev clang mold
RUN LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+') && \ RUN LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+') && \
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" && \ curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" && \

View file

@ -22,6 +22,11 @@
"source": "devcontainer-cargo-cache-${containerWorkspaceFolderBasename}", "source": "devcontainer-cargo-cache-${containerWorkspaceFolderBasename}",
"target": "/usr/local/cargo", "target": "/usr/local/cargo",
"type": "volume" "type": "volume"
},
{
"source": "${localWorkspaceFolderBasename}-target",
"target": "${containerWorkspaceFolder}/target",
"type": "volume"
} }
], ],
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.
@ -56,13 +61,9 @@
"rust-lang.rust-analyzer", "rust-lang.rust-analyzer",
"mutantdino.resourcemonitor", "mutantdino.resourcemonitor",
"christian-kohler.path-intellisense", "christian-kohler.path-intellisense",
"Swellaby.vscode-rust-test-adapter",
"Gruntfuggly.todo-tree", "Gruntfuggly.todo-tree",
"ms-azuretools.vscode-docker", "ms-azuretools.vscode-docker",
"redhat.vscode-yaml", "redhat.vscode-yaml"
"GitHub.copilot-nightly",
"GitHub.copilot-chat"
// "GitHub.copilot"
] ]
} }
} }

View file

@ -2,14 +2,16 @@ Fetches and caches data from csv download and saves the data in parquet format
# Dev Install # Dev Install
## Dev Containers ## Dev Containers
Install docker, vscode, [Remote Development Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack), and the [GitHub Repositories Extension](https://marketplace.visualstudio.com/items?itemName=GitHub.remotehub) Install docker, vscode and the [Dev Containers Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
`Ctrl+Shift+P` **Dev Containers: Clone Repository in Container Volume** `git clone`
Select github then paste the url `https://github.com/NexVeridian/ark-invest-api-rust-data` `Ctrl+Shift+P` **Dev Containers: Open Folder in Container**
Run code with `F5` or `cargo run` Run code with `F5` or `cargo run`
Run tests with `cargo t`
## Docker Compose ## Docker Compose
`git clone` `git clone`

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,9 @@ use polars::prelude::{DataFrame, StrptimeOptions, UniqueKeepStrategy};
use reqwest::blocking::Client; use reqwest::blocking::Client;
use serde_json::Value; use serde_json::Value;
use std::error::Error; use std::error::Error;
use std::fs::File; use std::fs::{create_dir_all, File};
use std::io::Cursor; use std::io::Cursor;
use std::path::{Path, PathBuf};
use std::result::Result; use std::result::Result;
use strum_macros::EnumIter; use strum_macros::EnumIter;
@ -157,7 +158,12 @@ impl Ark {
} }
fn write_df_parquet(path: String, df: DF) -> Result<(), Box<dyn Error>> { fn write_df_parquet(path: String, df: DF) -> Result<(), Box<dyn Error>> {
ParquetWriter::new(File::create(path)?).finish(&mut df.collect()?)?; if let Some(parent) = Path::new(&path).parent() {
if !parent.exists() {
create_dir_all(parent)?;
}
}
ParquetWriter::new(File::create(&path)?).finish(&mut df.collect()?)?;
Ok(()) Ok(())
} }