Kibot API Client (.NET)
Kibot API Client is an open-source .NET application that demonstrates the full communication between a client and the Kibot Historical Data API. It ships as both source and binary, covers authentication, gzip decompression, and per-symbol historical-data download, and is intended as a starting point for anyone building a Windows-hosted downloader or extending Kibot data access into an existing .NET application.
What it is
Kibot API Client is an open-source .NET application that demonstrates the communication between a client and Kibot's servers. It contains all the source code required for authentication and download of historical data. It is a small Windows Forms application with one main form, a few helper methods, and no third-party dependencies beyond the .NET base class libraries. Anything Kibot Agent does over the API can be reproduced from this codebase; Agent is a more elaborate UI layered on the same call patterns.
What is in the download
Six files are available, each useful for a different audience. All are plain zip archives:
| Artifact | Audience | Contents |
|---|---|---|
| Source, VB.NET 2010 (82 KB) | Visual Studio 2010+ users | Full VS solution: forms, code-behind, project file |
| Source, C# 2010 (77 KB) | VS 2010+ users on the C# side | Same solution structure, C# language surface |
| Source, VB.NET 2008 (36 KB) | Legacy .NET 2.0/3.5 toolchains | Same code, older project format |
| Source, C# 2008 (36 KB) | Legacy C# users | Same code, older project format |
| Compiled binary (42 KB) | Anyone with .NET Framework 2.0+ installed | Drop-in .exe plus required DLLs |
| Portable version (23 MB) | Users without admin rights | Single standalone .exe, no runtimes or installation required |
The portable variant is the fastest way to confirm a Kibot account works end to end without installing anything:
- Copy the
.exeto a folder. - Double-click it.
- Log in.
- Request data.
Runtime compatibility
Kibot API Client is built against .NET Framework 2.0 and is forward-compatible with every later Framework runtime (3.0, 3.5, 4.0, 4.5, 4.6, 4.7, 4.8). That choice keeps the binary universally runnable on modern Windows: the inbox .NET Framework 4.8 on Windows 10 and 11 has the 2.0 compatibility shim and runs the executable without extra installs. Nothing else needs to be downloaded on a current Windows machine.
For new .NET Core / .NET 5+ codebases, the sample is still useful as reference but should not be linked against directly. Port the call sequence to HttpClient with HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, UseCookies = true }. The line-by-line equivalents are covered in the .NET section of API client examples.
Building the source
To open and modify the project, install Microsoft Visual Studio (any edition from 2008 forward). The free Visual Studio Community works for non-commercial use; the older Visual Studio 2010 Express still opens the 2010 solution files cleanly. Pick the language and toolchain that matches the codebase you will integrate the result into; the VB.NET and C# versions are line-for-line equivalent.
The build steps are conventional:
- Download and extract the source zip for your chosen language and Visual Studio version.
- Open the
.slnfile in Visual Studio. - Restore any NuGet packages (the default project does not reference any; this step is for forks that add HTTP libraries or logging).
- Build the solution. The output is a single Windows Forms executable.
- Run the binary, enter your Kibot credentials, and confirm a sample download succeeds.
How it maps to the API
The sample exercises the exact endpoint surface documented in API overview. Concretely:
- Login. Calls
https://api.kibot.com/?action=login&user=<email>&password=<pwd>and validates that the response body starts with200. The session cookie returned is captured by the underlyingHttpWebRequestmachinery and reused on subsequent requests. See API authentication. - History fetch. Calls
https://api.kibot.com/?action=history&symbol=<sym>&interval=<interval>&period=<n>withAutomaticDecompressionenabled so the gzip response stream is decompressed transparently before it reaches user code. See History request. - Status / logout. Optional, included to demonstrate the session housekeeping endpoints covered in API authentication.
- Adjustments. Not exercised by the bundled UI but trivial to add, they use the same URL shape with
action=adjustments. See Adjustments request.
Extending the client
The bundled UI is intentionally minimal: one symbol, one interval, one fetch button. Production downloaders forked from it typically add the same four extensions, in the same order:
Batch symbol loops. Replace the single-symbol form field with a loaded symbol list and iterate. The Kibot session stays valid for 20 minutes of inactivity, so a tight loop reuses one login across the full batch. Re-login only when the server returns 401 Not Logged In; that pattern is what Kibot Agent uses internally and is the canonical way to keep wall-clock time low for batches of hundreds of symbols. The server waits 20 minutes of inactivity before it logs you out, so you only need to log in once before you start downloading, as long as you do not pause or stop the download process.
Retry-on-error logic. The api.kibot.com address routes to a pool of physical servers; a transient failure on one back-end can return a sporadic error even when the next request succeeds. Watch for an error code at the start of the response body (the API sends HTTP status 200 even for errors) or a failed connection, sleep ~10 seconds, retry. Repeat the request if you detect an error; this makes the download more robust, and Kibot Agent uses the same logic.
Bounded parallelism. The server pool tolerates more than one connection per account, but only up to a point. Recommended ceiling is 5 concurrent connections per account (shared across the API, FTP, and Kibot Agent; a recommendation, not a hard limit). Past that, downloads slow down rather than speed up because the bottleneck shifts to local disk and the per-server rate-limit guards. The hard limits are higher (40 concurrent requests and 50 requests per 500 ms, per server), but 5 is the practical ceiling.
Logging and resumability. Persist a per-symbol success/failure log so a long batch can be resumed without re-downloading completed files. Forks running on cloud Windows VMs commonly add a SQLite or simple CSV ledger here. Watch for antivirus and corporate proxies stripping gzip: if a previously working integration starts returning uncompressed data, the most common cause is antivirus software or a proxy server on your side that unzips the server response to check it and then rewrites the response headers on the fly.
When to use this vs. rolling your own
Reach for Kibot API Client when:
- You need a Windows GUI downloader and want a working scaffold to extend.
- Your shop is already on .NET Framework and you want a sample that drops cleanly into an existing Visual Studio solution.
- You need to confirm an account works end-to-end against the API before writing any code at all (run the portable
.exe, log in, download).
Roll your own when:
- Your target is Linux or macOS: see the curl, Python, Go, Rust, or TypeScript snippets in API client examples.
- You are on .NET Core / .NET 5+ and want
HttpClient-native code. The line-by-line port is in the .NET section of API client examples. - You need adjustments or tick endpoints that the bundled UI does not expose. The sample is a fine scaffold but you will be adding most of the surface yourself.
Key Takeaways
- Kibot API Client is the canonical open-source .NET reference for the Historical Data API, available as VB.NET and C# source (2008 and 2010 project formats) plus compiled and portable binaries.
- Built on .NET Framework 2.0; runs unchanged on every later Framework runtime including the 4.8 inbox on Windows 10 and 11.
- The sample exercises
loginandhistoryend-to-end withAutomaticDecompressionfor gzip, which is the right call pattern for batch downloaders. - Common forks add four things in order: batch symbol loops, retry-on-error, bounded parallelism (5 connections recommended), and a resumability ledger.
- On modern .NET Core / .NET 5+, port the call shape to
HttpClient+HttpClientHandler { AutomaticDecompression = ... }rather than linking the legacyHttpWebRequestcode directly.
Related
- API client examples: Reference implementations in eight environments, including the modern
HttpClientport of the .NET sample. - API overview: Endpoint inventory, subscription tiers, and the v2 feature set the .NET sample can drive.
- API authentication: Login flow, 20-minute idle timeout, and the skip-login pattern.
- History request: The
?action=historyparameters the sample's data fetch uses. - Server responses: response codes the sample (and any fork) should branch on.
- Kibot Agent: The full GUI built on the same endpoints; useful to compare extension ideas against.