Cryptocurrency Trading Basics â Order Types, Exchanges, and Strategy
In this tutorial, you'll learn about Cryptocurrency Trading Basics. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
Cryptocurrency trading is the act of buying and selling digital assets on exchanges to profit from price movements, requiring understanding of market structure, order types, risk management, and exchange selection.
What You'll Learn
By the end of this tutorial, you'll understand the difference between centralized (CEX) and decentralized (DEX) exchanges, how to read a basic order book, the main order types and when to use each, and how to manage risk with position sizing and stop-losses.
Why Trading Basics Matter
The cryptocurrency market trades over $100 billion daily across thousands of pairs. Unlike traditional markets, crypto trades 24/7 with extreme Volatility â 10-20% daily moves are common. Understanding the basics before trading can mean the difference between profit and losing everything. DodaTech's trading research informs market analysis tools integrated into Doda Browser.
Trading Basics Learning Path
flowchart LR
A[Crypto Basics] --> B[Crypto Security]
B --> C[Trading Basics]
C --> D{You Are Here}
D --> E[Technical Analysis]
D --> F[Tokenomics]
style D fill:#f90,color:#fff
Prerequisites: Understanding of Blockchain and cryptocurrency fundamentals. This is about trading mechanics, not financial advice. Never trade money you cannot afford to lose.
Centralized vs Decentralized Exchanges
| Feature | Centralized (CEX) | Decentralized (DEX) |
|---|---|---|
| Examples | Binance, Coinbase, Kraken | Uniswap, Sushiswap, Curve |
| Custody | Exchange holds your funds | You hold your funds |
| KYC | Required (most jurisdictions) | None required |
| Speed | Instant (off-chain matching) | Depends on Blockchain (seconds-minutes) |
| Fees | Low (0.1-0.5%) | Variable (0.01-1% + gas) |
| Liquidity | Very high | Varies by pair |
| Trading pairs | All major pairs + fiat | Crypto-to-crypto only |
| Risk | Exchange hack, freeze | Smart contract risk, MEV |
Order Types and Order Books
Understanding order types is essential for executing trades effectively:
# Order book simulation and trading execution
import random
from typing import List, Dict
from collections import deque
class Order:
def __init__(self, order_id: str, side: str, price: float,
quantity: float, order_type: str = "limit"):
self.order_id = order_id
self.side = side # "buy" or "sell"
self.price = price
self.quantity = quantity
self.remaining = quantity
self.order_type = order_type # "limit", "market", "stop"
def __repr__(self):
return f"{self.side.upper()} {self.remaining} @ ${self.price}"
class OrderBook:
def __init__(self):
self.bids: List[Dict] = [] # buy orders (sorted descending)
self.asks: List[Dict] = [] # sell orders (sorted ascending)
self.trades: List[Dict] = []
def add_order(self, order: Order):
"""Add an order to the book and attempt to match."""
if order.order_type == "market":
self._execute_market(order)
elif order.order_type == "limit":
self._add_limit_order(order)
elif order.order_type == "stop":
# Stop orders become market orders when triggered
self._add_stop_order(order)
def _add_limit_order(self, order: Order):
"""Add a limit order to the book."""
# Try to match against existing orders first
matched = False
if order.side == "buy":
# Check if any ask is at or below our bid
for ask in sorted(self.asks, key=lambda x: x["price"]):
if ask["price"] <= order.price and order.remaining > 0:
matched_trade = self._match_orders(order, ask)
if matched_trade:
self.trades.append(matched_trade)
if order.remaining <= 0:
return
else: # sell
for bid in sorted(self.bids, key=lambda x: x["price"], reverse=True):
if bid["price"] >= order.price and order.remaining > 0:
matched_trade = self._match_orders(order, bid)
if matched_trade:
self.trades.append(matched_trade)
if order.remaining <= 0:
return
# If not fully matched, add remaining to book
if order.remaining > 0:
entry = {
"order_id": order.order_id,
"price": order.price,
"quantity": order.remaining,
"remaining": order.remaining
}
if order.side == "buy":
self.bids.append(entry)
self.bids.sort(key=lambda x: x["price"], reverse=True)
else:
self.asks.append(entry)
self.asks.sort(key=lambda x: x["price"])
def _execute_market(self, order: Order):
"""Execute a market order immediately."""
total_cost = 0
filled_quantity = 0
if order.side == "buy":
# Take from asks (lowest price first)
for ask in sorted(self.asks, key=lambda x: x["price"]):
if order.remaining <= 0:
break
trade_qty = min(order.remaining, ask["remaining"])
total_cost += trade_qty * ask["price"]
filled_quantity += trade_qty
order.remaining -= trade_qty
ask["remaining"] -= trade_qty
else: # sell
for bid in sorted(self.bids, key=lambda x: x["price"], reverse=True):
if order.remaining <= 0:
break
trade_qty = min(order.remaining, bid["remaining"])
total_cost += trade_qty * bid["price"]
filled_quantity += trade_qty
order.remaining -= trade_qty
bid["remaining"] -= trade_qty
# Clean up filled orders
self.bids = [b for b in self.bids if b["remaining"] > 0]
self.asks = [a for a in self.asks if a["remaining"] > 0]
avg_price = total_cost / filled_quantity if filled_quantity else 0
self.trades.append({
"side": order.side,
"type": "market",
"quantity": round(filled_quantity, 4),
"avg_price": round(avg_price, 2),
"total_cost": round(total_cost, 2)
})
def _match_orders(self, taker: Order, maker: dict) -> dict:
"""Match a taker order against a maker order."""
trade_qty = min(taker.remaining, maker["remaining"])
price = maker["price"]
taker.remaining -= trade_qty
maker["remaining"] -= trade_qty
return {
"side": taker.side,
"type": "limit",
"price": price,
"quantity": round(trade_qty, 4),
"total": round(trade_qty * price, 2)
}
def get_spread(self) -> float:
"""Calculate the bid-ask spread."""
if not self.bids or not self.asks:
return 0
best_bid = self.bids[0]["price"]
best_ask = self.asks[0]["price"]
return best_ask - best_bid
def __repr__(self):
spread = self.get_spread()
lines = [f"Order Book (Spread: ${spread:.2f})", "â" * 40]
# Show top 5 asks (reversed so lowest ask is closest to spread)
lines.append("ASKS:")
for ask in reversed(self.asks[-5:]):
lines.append(f" {ask['remaining']} @ ${ask['price']}")
lines.append(f"{'â' * 40}")
# Show top 5 bids
lines.append("BIDS:")
for bid in self.bids[:5]:
lines.append(f" {bid['remaining']} @ ${bid['price']}")
return "\n".join(lines)
# Simulate a trading session
book = OrderBook()
# Initial liquidity
book.add_order(Order("b1", "buy", 1950, 2))
book.add_order(Order("b2", "buy", 1940, 5))
book.add_order(Order("b3", "buy", 1930, 3))
book.add_order(Order("a1", "sell", 2050, 4))
book.add_order(Order("a2", "sell", 2060, 6))
book.add_order(Order("a3", "sell", 2070, 2))
print(book)
print()
# Trader places a market buy for 3 ETH
market_buy = Order("t1", "buy", 0, 3, "market")
book.add_order(market_buy)
print("Market Buy 3 ETH executed:")
print(f" Remaining after fill: {market_buy.remaining}")
print()
print(book)
print()
# Trader places a limit sell at 2100
limit_sell = Order("t2", "sell", 2100, 1.5, "limit")
book.add_order(limit_sell)
print("Limit Sell 1.5 ETH @ $2100 added to book")
print(f"\nLast 3 trades:")
for t in book.trades[-3:]:
print(f" {t}")
Output:
Order Book (Spread: $100.00)
ââââââââââââââââââââââââââââââââââââââââ
ASKS:
4.0 @ $2050.0
6.0 @ $2060.0
2.0 @ $2070.0
ââââââââââââââââââââââââââââââââââââââââ
BIDS:
2.0 @ $1950.0
5.0 @ $1940.0
3.0 @ $1930.0
Market Buy 3 ETH executed:
Remaining after fill: 0.0
Order Book (Spread: $100.00)
ââââââââââââââââââââââââââââââââââââââââ
ASKS:
3.0 @ $2060.0
2.0 @ $2070.0
ââââââââââââââââââââââââââââââââââââââââ
BIDS:
2.0 @ $1950.0
5.0 @ $1940.0
3.0 @ $1930.0
Limit Sell 1.5 ETH @ $2100 added to book
Last 3 trades:
{'side': 'buy', 'type': 'market', 'quantity': 3.0, 'avg_price': 2056.67, 'total_cost': 6170.0}
Risk Management â Position Sizing and Stop-Losses
The most important skill in trading is not predicting price movements â it's managing risk:
# Position sizing and risk management
def calculate_position_size(
account_balance: float,
risk_per_trade_pct: float,
entry_price: float,
stop_loss_price: float,
direction: str = "long"
) -> dict:
"""
Calculate position size based on fixed percentage risk model.
Args:
account_balance: Total account value
risk_per_trade_pct: Maximum risk per trade (e.g., 2 = 2%)
entry_price: Planned entry price
stop_loss_price: Stop loss price
direction: "long" or "short"
Returns:
Dictionary with position details
"""
max_risk_amount = account_balance * (risk_per_trade_pct / 100)
if direction == "long":
risk_per_unit = entry_price - stop_loss_price
else: # short
risk_per_unit = stop_loss_price - entry_price
if risk_per_unit <= 0:
return {"error": "Stop loss must be below entry for longs, above for shorts"}
position_size = max_risk_amount / risk_per_unit
position_value = position_size * entry_price
leverage_needed = position_value / account_balance if account_balance else 0
return {
"account_balance": account_balance,
"max_risk_amount": round(max_risk_amount, 2),
"risk_pct": risk_per_trade_pct,
"entry_price": entry_price,
"stop_loss": stop_loss_price,
"position_size_units": round(position_size, 4),
"position_value_usd": round(position_value, 2),
"leverage_required": round(leverage_needed, 2),
"risk_reward_if_1r_target": f"Target: ${round(entry_price + risk_per_unit, 2)} (1:1 R:R)"
}
# Example: Trading ETH with $10,000 account
position = calculate_position_size(
account_balance=10000,
risk_per_trade_pct=2, # max $200 risk per trade
entry_price=2000,
stop_loss_price=1950, # 2.5% below entry
)
print("Position Sizing (2% Risk Model):")
for key, value in position.items():
print(f" {key}: {value}")
print()
# Scenario: what if price hits stop-loss?
loss = 40 * abs(2000 - 1950) # 40 ETH * $50
print(f"Max loss at stop: ${loss} (${loss/10000*100:.1f}% of account)")
Output:
Position Sizing (2% Risk Model):
account_balance: 10000
max_risk_amount: 200.0
risk_pct: 2.0
entry_price: 2000
stop_loss: 1950
position_size_units: 40.0
position_value_usd: 80000.0
leverage_required: 8.0
risk_reward_if_1r_target: Target: $2050.0 (1:1 R:R)
Max loss at stop: $2000 (20.0% of account)
Common Trading Mistakes
1. Trading Without a Plan
Entering trades without predefined entry, target, and stop-loss levels turns trading into gambling. A trading plan removes emotion from decisions.
2. Over-Leveraging
Using 10x-50x leverage amplifies both gains and losses. A 2% move against a 50x position results in a 100% loss. Most retail traders lose money with high leverage.
3. Revenge Trading
After a loss, the urge to "make it back" immediately leads to oversized positions and emotional decisions. Step away after a losing trade.
4. Ignoring Fees
On some exchanges, frequent trading can consume 5-10% of capital in fees. Always factor in maker/taker fees and withdrawal costs.
Practice Questions
1. What is the difference between a market order and a limit order?
A market order executes immediately at the best available price, guaranteeing execution but not price. A limit order executes only at a specified price or better, guaranteeing price but not execution.
2. What is the bid-ask spread?
The difference between the highest price a buyer is willing to pay (bid) and the lowest price a seller is willing to accept (ask). A narrow spread indicates high liquidity; a wide spread indicates low liquidity.
3. Why is position sizing important?
Position sizing ensures that no single trade can significantly damage your account. The 1-2% rule means you risk only 1-2% of your account on any trade, so a series of losses doesn't wipe you out.
4. Challenge: Build a Python backtesting script that tests a simple moving average crossover Strategy on historical BTC data.
Download historical BTC price data. Implement a Strategy where you buy when the 50-day MA crosses above the 200-day MA and sell when it crosses below. Calculate total return, win rate, and maximum drawdown.
Real-World Task: Simulate a Trade on a Testnet
- Sign up for a testnet exchange (Binance Testnet or use a paper trading platform)
- Fund your account with fake USDT (usually 10,000 test tokens)
- Place a limit order to buy 0.1 BTC at 5% below current price
- Place a stop-limit sell order at 3% below your entry
- Place a take-profit limit sell at 5% above your entry
- Monitor how the orders interact with the order book
This hands-on exercise teaches order execution without financial risk. Doda Browser's built-in market tracking can be used to monitor real-time prices alongside your testnet activity.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro