oanda-v20-openapi 0.1.0

The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
Documentation
# OANDA v20 – Autogenerated Rust Client

> Status: pre-alpha. Autogenerated. Lightly hand-patched. Expect breaking changes.

This crate is an autogenerated Rust client for the OANDA v20 REST API. It is not well-tested and is under active development.
The upstream OpenAPI/Swagger spec appears out of date in places, so this repository includes a maintained copy of the v20 spec with small corrective patches.

I am not affiliated with OANDA. Use at your own risk.

## What you get

Autogenerated request/response types and API methods from an OpenAPI spec.

Minimal ergonomics added only where necessary to get things compiling.

No stability guarantees yet (SemVer 0.x; breaking changes may happen at any time).

## Why a self maintained spec?

The [public v20 spec](https://github.com/oanda/v20-openapi/blob/master/yaml/v20.yaml) doesn't work. Two notable issues this crate works around:

1. The public spec gives the same operationId (getInstrumentCandles) to two different endpoints:
   `GET /instruments/{instrument}/candles`
   and
   `GET /accounts/{accountID}/instruments/{instrument}/candles`. OpenAPI requires operationId values to be unique across all operations, so validators/generators fail on this collision.

2. Enums are generated from the spec using UPPER_SNAKE_CASE which raises 300+ warnings when compiling. `x-enum-varnames` is used in the spec to fix this.

If you spot another mismatch or want to suggest an improvement, please open an issue with the exact endpoint and a redacted sample payload.

## Current caveats

Hardly any test coverage. Basic unit tests exist for bugs I have found while using this crate in my own projects. Zero integration tests with the actuall API for now.

Generated code first. The only manual code in this crate is to test the generated code.

## Regenerating the client

This project is generated from the local spec (patched). Typical flow:

Edit the spec `v20-openapi.yaml` and keep patches minimal and documented.

Run the generation script `gen.sh` to rewrite the client code.

Build and run tests with `cargo test`.

## Testing

To avoid editing generated code, unit tests live under `tests/`.

## Versioning

Until 1.0, any release may contain breaking changes.

Release notes on GitHub will note the changes.

## Contributing

Issues and PRs are welcome, especially reports of spec/response mismatches with small, reproducible samples. Please keep changes narrowly scoped (one endpoint or one model at a time).

## Disclaimer

> This project is unofficial and not endorsed by OANDA.
>
> No warranties of any kind. The API and/or this client may change without notice.
>
> Foreign exchange and CFD trading involve significant risk of loss. Nothing here is financial advice.