| Crates.io | profitdll |
| lib.rs | profitdll |
| version | 0.1.0 |
| created_at | 2025-08-15 04:31:05.097362+00 |
| updated_at | 2025-08-15 04:31:05.097362+00 |
| description | Integração ProfitDLL (tipos + FFI opcional Windows) para o ecossistema Tucano |
| homepage | https://github.com/brbtavares/tucano |
| repository | https://github.com/brbtavares/tucano |
| max_upload_size | |
| id | 1796206 |
| size | 89,430 |
Camada isolada de integração (tipos + abstrações + FFI opcional) com a ProfitDLL (Nelógica).
Mini-Disclaimer: uso educacional/experimental; sem recomendação de investimento ou afiliação; Profit/ProfitDLL © Nelógica; veja DISCLAIMER no repositório principal.
Fornece:
CallbackEvent, BookAction, etc.)AssetIdentifier, AccountIdentifier)SendOrder)real_dll) carregamento dinâmico da DLL real (Windows)Cargo.toml[dependencies]
profitdll = "0.1"
Para usar a DLL real (Windows + DLL instalada/licenciada):
[dependencies]
profitdll = { version = "0.1", features = ["real_dll"] }
new_backend() tenta:
PROFITDLL_FORCE_MOCK=1.real_dll, tenta DLL real (usa PROFITDLL_PATH se definido).PROFIT_USER=seu_usuario
PROFIT_PASSWORD=sua_senha
PROFIT_ACTIVATION_KEY=opcional
PROFITDLL_PATH=C:\\caminho\\ProfitDLL.dll # opcional
PROFITDLL_FORCE_MOCK=1 # força mock
use profitdll::{new_backend, SendOrder};
use rust_decimal::Decimal;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let backend = new_backend()?; // mock ou real dependendo do ambiente
let creds = profitdll::api::Credentials::from_env()?;
let mut events = backend.initialize_login(&creds).await?;
backend.subscribe_ticker("PETR4", "B")?;
backend.send_order(&SendOrder { /* campos */ ..Default::default() })?;
// consumir events.try_recv() ...
Ok(())
}
real_dll: habilita FFI para a DLL real (Windows). Sem ela, apenas mock.#[non_exhaustive] podem receber variantes futuras sem breaking change.Consulte MANUAL.md (quando presente) e os comentários inline dos tipos principais.
LICENSE).Mini-Disclaimer repetido: uso educacional; sem recomendação; sem afiliação; Profit/ProfitDLL © Nelógica.