# How to use a GitHub repository: the basics

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/guides/use-a-github-repository, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

A repository is a folder of code that someone has published. This is how to get one onto your computer and running, in a couple of minutes, without knowing Git.

- Checked: no record printed here carries a checked date

## The two minute version

### 1. Open the repository page

Every repository on our [list](https://openbrokerapi.com/github) has a button that opens it on GitHub. The front page shows the files, and below them the README, which is the project's own instructions.

### 2. Get the files

Click the green Code button, then Download ZIP, and unzip it. That is all you need to look around. If you have Git installed, cloning is better because you can fetch updates later:

```bash
git clone https://github.com/OWNER/NAME.git
cd NAME
```

Each repository page on this site prints that command with the real names filled in.

### 3. Install what it needs

Most trading projects are Python. Make a private environment so the project's packages do not mix with anything else, then install them:

```
python -m venv .venv
.venv\Scripts\activate          (Windows)
source .venv/bin/activate       (macOS or Linux)
pip install -r requirements.txt
```

If there is no requirements.txt, the README says what to run instead.

### 4. Run the example

Look for a folder called examples, or a quick start section in the README, and run the smallest thing it offers. Get that working before you change anything.

## Before it touches a broker account

- Read the code that sends orders. If you cannot follow it, do not run it against an account.
- Use a demo account first, and keep it there until it has run for weeks without a surprise.
- Put API keys in environment variables on your own machine. Never paste them into a file in the project, because it is easy to publish them by accident.
- Check the licence, the date of the last update and the open issues. A project nobody has touched in years may no longer work with the broker's current API.
- Stars measure attention, not safety. A popular repository can still be wrong, abandoned or unsafe.

[How to keep an API key out of your code](https://openbrokerapi.com/learn/keys-and-demo-accounts)

## What to look at on a repository page

- README: what it does and how to run it. Start here.
- Licence: whether you may reuse the code, and on what terms.
- Last update: whether anyone still maintains it.
- Issues: what other people have found broken, and whether anyone answers.
- Releases: a numbered version is usually safer to run than whatever was changed this morning.

## Try it on today's pick

There are 70 maintained repositories on our list. Here is the one in today's slot.

The pick changes every day, so it is not printed in this file. [Repository of the day](https://openbrokerapi.com/repo-of-the-day) shows the one in today's slot and how the pick works.

## Common questions

### Do I need a GitHub account?

No. You can read, download and clone any public repository without one. You need an account only to save your own code there, report a problem or suggest a change.

### Is it safe to run code from GitHub?

It is as safe as the code is. Anyone can publish a repository. Read what it does before you run it, prefer projects with a licence and recent activity, and never give a script a live trading key until you have watched it behave on a demo account.

### What is the difference between downloading and cloning?

Downloading gives you a copy of the files as they are today. Cloning with Git gives you the same files plus the ability to pull in later updates with one command.

### What does a licence mean for me?

It says what you may do with the code. Permissive licences such as MIT and Apache 2.0 let you use and change it freely. Copyleft licences such as GPL ask you to share your changes under the same terms if you distribute them. No licence means you have no clear right to reuse it.

## Where next

Never written code? [Start the learning track](https://openbrokerapi.com/learn). Ready to talk to a broker? [Getting started with API trading](https://openbrokerapi.com/guides/getting-started-with-api-trading). Looking for code to try? [The repository list](https://openbrokerapi.com/github) and [the other guides](https://openbrokerapi.com/guides).

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: How to use a GitHub repository: the basics. Broker API Hub, https://openbrokerapi.com/guides/use-a-github-repository, no checked date recorded.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
