Bid ?????????????????????
Bid ?????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? ??????????????????????????? ?????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????? ???????????????????????? bid ?????????????????????????????????????????? digital advertising
???????????????????????????????????? Bid ????????????????????????????????????????????? Google Ads ????????????????????? bidding ???????????????????????????????????????????????? (CPC), Real-Time Bidding (RTB) ????????????????????????????????????????????????????????????????????????????????? programmatic, E-commerce auction ???????????? eBay ???????????????????????????????????????????????????????????????????????????, Government procurement ???????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????????? Bid ?????????????????????????????? Bid Price ?????????????????????????????????, Ask Price ????????????????????????????????????????????????????????????, Bid-Ask Spread ????????????????????????????????????????????? bid ????????? ask, Bid Increment ?????????????????????????????????????????????????????????, Reserve Price ??????????????????????????????????????????????????????????????????????????????
???????????????????????????????????? Bid
??????????????????????????? bid ????????????????????????????????????
# === Types of Bidding Systems ===
cat > bidding_types.yaml << 'EOF'
bidding_systems:
auction_types:
english_auction:
name: "English Auction (Open Ascending)"
description: "??????????????????????????????????????? ??????????????????????????????????????????????????????????????????"
how_it_works: "???????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????"
examples: ["eBay", "Sotheby's", "Christie's"]
use_case: "??????????????????????????????????????????????????????????????????????????? ??????????????? ?????????????????????"
dutch_auction:
name: "Dutch Auction (Open Descending)"
description: "????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????"
how_it_works: "????????????????????????????????????????????? ???????????????????????????????????? ???????????????????????????????????????????????????????????????"
examples: ["Dutch flower auctions", "Treasury bonds", "IPO"]
use_case: "???????????????????????????????????????????????????????????? ?????????????????? ??????????????????????????????????????????????????????"
sealed_bid:
name: "Sealed-Bid Auction"
description: "????????????????????????????????????????????? ????????????????????????????????????????????????????????????"
how_it_works: "???????????????????????? bid ???????????????????????? ???????????????????????????????????? ???????????????????????????????????????"
examples: ["Government procurement", "Construction contracts"]
use_case: "??????????????????????????? ???????????????????????????????????????"
vickrey_auction:
name: "Vickrey Auction (Second-Price)"
description: "??????????????????????????????????????????????????????????????????????????????"
how_it_works: "Sealed-bid ???????????????????????????????????????????????????????????? bid ???????????????????????????????????? 2"
examples: ["Google Ads (modified)", "eBay proxy bidding"]
use_case: "?????????????????????????????? bid ???????????????????????? ????????????????????? strategic bidding"
digital_bidding:
cpc_bidding:
name: "Cost-Per-Click (CPC)"
platform: "Google Ads, Facebook Ads"
how: "??????????????????????????????????????????????????????????????????"
cpm_bidding:
name: "Cost-Per-Mille (CPM)"
platform: "Display ads, YouTube"
how: "????????????????????? 1,000 impressions"
rtb:
name: "Real-Time Bidding (RTB)"
platform: "Programmatic advertising"
how: "??????????????????????????????????????????????????????????????? real-time ??????????????? 100ms"
cpa_bidding:
name: "Cost-Per-Action (CPA)"
platform: "Affiliate marketing"
how: "????????????????????????????????? conversion (?????????????????????????????? ?????????????????????????????????)"
EOF
echo "Bidding types defined"
???????????? Bidding ???????????????????????????
??????????????????????????? automated bidding
#!/usr/bin/env python3
# auto_bidding.py ??? Automated Bidding System
import json
import logging
import time
from typing import Dict, List, Optional
from datetime import datetime
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("bidding")
class BiddingEngine:
def __init__(self):
self.auctions = {}
self.bids = {}
def create_auction(self, item_id, title, start_price, reserve_price=None,
bid_increment=100, duration_minutes=60):
"""Create a new auction"""
auction = {
"item_id": item_id,
"title": title,
"start_price": start_price,
"current_price": start_price,
"reserve_price": reserve_price or start_price,
"bid_increment": bid_increment,
"highest_bidder": None,
"bid_count": 0,
"bids": [],
"status": "active",
"created_at": datetime.utcnow().isoformat(),
"ends_at": None,
}
self.auctions[item_id] = auction
logger.info(f"Auction created: {title} starting at {start_price}")
return auction
def place_bid(self, item_id, bidder_id, amount):
"""Place a bid on an auction"""
auction = self.auctions.get(item_id)
if not auction:
return {"error": "Auction not found"}
if auction["status"] != "active":
return {"error": "Auction is not active"}
min_bid = auction["current_price"] + auction["bid_increment"]
if amount < min_bid:
return {"error": f"Bid must be at least {min_bid}"}
bid = {
"bidder_id": bidder_id,
"amount": amount,
"timestamp": datetime.utcnow().isoformat(),
}
auction["bids"].append(bid)
auction["current_price"] = amount
auction["highest_bidder"] = bidder_id
auction["bid_count"] += 1
logger.info(f"Bid placed: {bidder_id} bids {amount} on {item_id}")
return {
"status": "accepted",
"bid": bid,
"current_price": amount,
"bid_count": auction["bid_count"],
}
def close_auction(self, item_id):
"""Close auction and determine winner"""
auction = self.auctions.get(item_id)
if not auction:
return {"error": "Auction not found"}
auction["status"] = "closed"
if auction["current_price"] >= auction["reserve_price"] and auction["highest_bidder"]:
return {
"status": "sold",
"winner": auction["highest_bidder"],
"final_price": auction["current_price"],
"total_bids": auction["bid_count"],
}
return {
"status": "not_sold",
"reason": "Reserve price not met" if auction["highest_bidder"] else "No bids",
"highest_bid": auction["current_price"],
"reserve": auction["reserve_price"],
}
def auto_bid(self, item_id, bidder_id, max_amount, strategy="increment"):
"""Automatic bidding up to max amount"""
auction = self.auctions.get(item_id)
if not auction:
return {"error": "Auction not found"}
if strategy == "increment":
bid_amount = auction["current_price"] + auction["bid_increment"]
elif strategy == "aggressive":
bid_amount = auction["current_price"] + (auction["bid_increment"] * 3)
elif strategy == "snipe":
bid_amount = max_amount
else:
bid_amount = auction["current_price"] + auction["bid_increment"]
if bid_amount > max_amount:
return {"status": "max_reached", "max": max_amount, "current": auction["current_price"]}
return self.place_bid(item_id, bidder_id, bid_amount)
engine = BiddingEngine()
auction = engine.create_auction("item001", "Vintage Camera", 1000, reserve_price=5000, bid_increment=500)
print(f"Auction: {auction['title']} @ {auction['start_price']} THB")
engine.place_bid("item001", "user_a", 1500)
engine.place_bid("item001", "user_b", 2500)
engine.place_bid("item001", "user_a", 3500)
engine.auto_bid("item001", "user_c", max_amount=6000, strategy="aggressive")
result = engine.close_auction("item001")
print(f"Result: {json.dumps(result, indent=2)}")
??????????????????????????? Auction ???????????? Python
???????????? Real-Time Bidding
#!/usr/bin/env python3
# rtb_system.py ??? Real-Time Bidding System
import json
import logging
import time
import random
from typing import Dict, List
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("rtb")
class RTBSystem:
def __init__(self):
self.advertisers = {}
self.bid_requests = []
def register_advertiser(self, advertiser_id, name, budget, target_cpm):
"""Register an advertiser"""
self.advertisers[advertiser_id] = {
"id": advertiser_id,
"name": name,
"budget": budget,
"spent": 0,
"target_cpm": target_cpm,
"impressions": 0,
"clicks": 0,
}
return self.advertisers[advertiser_id]
def create_bid_request(self, publisher_id, ad_slot, user_data):
"""Create a bid request (from publisher)"""
return {
"request_id": f"req_{int(time.time()*1000)}",
"publisher_id": publisher_id,
"ad_slot": ad_slot,
"user_data": user_data,
"floor_price": ad_slot.get("floor_price", 0.5),
"timestamp": time.time(),
}
def run_auction(self, bid_request):
"""Run RTB auction for a bid request"""
bids = []
for adv_id, adv in self.advertisers.items():
if adv["spent"] >= adv["budget"]:
continue
# Calculate bid based on targeting
base_bid = adv["target_cpm"] / 1000
relevance = self._calculate_relevance(adv, bid_request["user_data"])
bid_price = base_bid * relevance
if bid_price >= bid_request["floor_price"]:
bids.append({
"advertiser_id": adv_id,
"bid_price": round(bid_price, 4),
"relevance": round(relevance, 2),
})
if not bids:
return {"status": "no_fill", "request_id": bid_request["request_id"]}
# Sort by bid price (highest wins)
bids.sort(key=lambda x: x["bid_price"], reverse=True)
winner = bids[0]
# Second-price auction
clearing_price = bids[1]["bid_price"] if len(bids) > 1 else bid_request["floor_price"]
# Update advertiser stats
self.advertisers[winner["advertiser_id"]]["spent"] += clearing_price
self.advertisers[winner["advertiser_id"]]["impressions"] += 1
return {
"status": "filled",
"winner": winner["advertiser_id"],
"bid_price": winner["bid_price"],
"clearing_price": round(clearing_price, 4),
"total_bids": len(bids),
"auction_type": "second_price",
}
def _calculate_relevance(self, advertiser, user_data):
"""Calculate ad relevance score"""
score = 0.5
if user_data.get("interests"):
score += 0.3
if user_data.get("location"):
score += 0.1
if user_data.get("device") == "mobile":
score += 0.1
return min(score, 1.0)
rtb = RTBSystem()
rtb.register_advertiser("adv1", "TechShop", budget=10000, target_cpm=50)
rtb.register_advertiser("adv2", "FashionStore", budget=8000, target_cpm=35)
rtb.register_advertiser("adv3", "FoodApp", budget=5000, target_cpm=25)
request = rtb.create_bid_request(
"pub001",
{"size": "300x250", "floor_price": 0.01},
{"interests": ["tech"], "location": "Bangkok", "device": "mobile"},
)
result = rtb.run_auction(request)
print(f"RTB Result: {json.dumps(result, indent=2)}")
for adv_id, adv in rtb.advertisers.items():
print(f" {adv['name']}: spent {adv['spent']:.4f}, impressions {adv['impressions']}")
?????????????????????????????? Bid ????????????????????????
???????????????????????????????????????????????? bid ????????????????????????????????????
# === Bidding Strategies ===
cat > strategies.json << 'EOF'
{
"google_ads_strategies": {
"manual_cpc": {
"name": "Manual CPC",
"description": "??????????????????????????? bid ????????? ????????? keyword",
"best_for": "?????????????????????????????????????????????????????????????????? control ?????????????????????",
"pros": ["Control ??????????????????", "???????????? bid ?????????????????????????????? keyword"],
"cons": ["??????????????????????????????", "???????????? monitor ????????????"]
},
"maximize_clicks": {
"name": "Maximize Clicks",
"description": "Google ???????????? bid ???????????????????????????????????????????????????????????? clicks ???????????????????????????",
"best_for": "??????????????? traffic, brand awareness",
"pros": ["????????????", "????????? clicks ????????????"],
"cons": ["?????????????????? clicks ???????????????????????????", "????????? optimize for conversion"]
},
"target_cpa": {
"name": "Target CPA",
"description": "Google ???????????? bid ????????????????????????????????? cost per conversion ?????????????????????????????????",
"best_for": "Optimize for conversions",
"pros": ["????????? conversions ????????? budget", "Automated"],
"cons": ["?????????????????? conversion data ????????????????????? (30+ conversions/???????????????)"]
},
"target_roas": {
"name": "Target ROAS",
"description": "Google ???????????? bid ????????????????????????????????? return on ad spend ?????????????????????",
"best_for": "E-commerce ????????? track revenue",
"pros": ["Maximize revenue", "ROI focused"],
"cons": ["???????????? track revenue accurately", "?????????????????? data ????????????"]
}
},
"procurement_strategies": {
"competitive_bid": {
"description": "?????????????????????????????????????????????????????????????????? ?????????????????????????????????",
"risk": "Margin ????????? ???????????????????????????"
},
"value_bid": {
"description": "????????????????????????????????????????????????????????????????????????????????????????????? value added",
"risk": "?????????????????????????????????????????????????????????????????????????????????????????????"
},
"strategic_bid": {
"description": "????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????",
"risk": "?????????????????????????????????????????? ??????????????????????????????????????????????????????"
}
}
}
EOF
python3 -c "
import json
with open('strategies.json') as f:
data = json.load(f)
print('Google Ads Strategies:')
for key, strategy in data['google_ads_strategies'].items():
print(f' {strategy[\"name\"]}: {strategy[\"best_for\"]}')
"
echo "Strategies defined"
????????????????????????????????????????????? Bid
Analyze bidding data
#!/usr/bin/env python3
# bid_analytics.py ??? Bid Data Analytics
import json
import logging
import math
from typing import Dict, List
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("analytics")
class BidAnalytics:
def __init__(self):
self.data = {}
def analyze_auction_results(self, auctions):
"""Analyze auction performance"""
total = len(auctions)
sold = sum(1 for a in auctions if a["status"] == "sold")
total_revenue = sum(a.get("final_price", 0) for a in auctions if a["status"] == "sold")
avg_bids = sum(a.get("bid_count", 0) for a in auctions) / max(total, 1)
return {
"total_auctions": total,
"sold": sold,
"sell_through_rate": round(sold / max(total, 1) * 100, 1),
"total_revenue": total_revenue,
"avg_final_price": round(total_revenue / max(sold, 1)),
"avg_bids_per_auction": round(avg_bids, 1),
}
def bid_optimization(self, campaign_data):
"""Optimize bid strategy"""
clicks = campaign_data.get("clicks", 0)
impressions = campaign_data.get("impressions", 0)
conversions = campaign_data.get("conversions", 0)
cost = campaign_data.get("cost", 0)
revenue = campaign_data.get("revenue", 0)
ctr = (clicks / max(impressions, 1)) * 100
cvr = (conversions / max(clicks, 1)) * 100
cpc = cost / max(clicks, 1)
cpa = cost / max(conversions, 1)
roas = revenue / max(cost, 1)
recommendations = []
if ctr < 2:
recommendations.append("CTR ????????? ???????????? ad copy ???????????? targeting")
if cvr < 3:
recommendations.append("Conversion rate ????????? ???????????? landing page")
if roas < 3:
recommendations.append("ROAS ????????? ?????? bid ???????????????????????? high-intent keywords")
if cpa > campaign_data.get("target_cpa", float("inf")):
recommendations.append("CPA ????????????????????????????????? ?????? bid 10-20%")
return {
"metrics": {
"ctr": f"{ctr:.2f}%",
"cvr": f"{cvr:.2f}%",
"cpc": f"{cpc:.2f} THB",
"cpa": f"{cpa:.0f} THB",
"roas": f"{roas:.1f}x",
},
"recommendations": recommendations,
"suggested_bid_adjustment": "-15%" if roas < 2 else "+10%" if roas > 5 else "maintain",
}
analytics = BidAnalytics()
auctions = [
{"status": "sold", "final_price": 5000, "bid_count": 8},
{"status": "sold", "final_price": 3200, "bid_count": 5},
{"status": "not_sold", "bid_count": 2},
{"status": "sold", "final_price": 7500, "bid_count": 12},
]
results = analytics.analyze_auction_results(auctions)
print(f"Auctions: {results['total_auctions']}, Sold: {results['sold']} ({results['sell_through_rate']}%)")
print(f"Revenue: {results['total_revenue']:,} THB")
campaign = {"clicks": 500, "impressions": 25000, "conversions": 20, "cost": 15000, "revenue": 60000, "target_cpa": 800}
opt = analytics.bid_optimization(campaign)
print(f"\nCampaign: CPC {opt['metrics']['cpc']}, ROAS {opt['metrics']['roas']}")
for rec in opt["recommendations"]:
print(f" - {rec}")
FAQ ??????????????????????????????????????????
Q: Bid ????????? Ask ???????????????????????????????????????????
A: Bid ??????????????????????????????????????????????????????????????? (????????????????????????????????????????????????) Ask ????????????????????????????????????????????????????????????????????? (?????????????????????????????????????????????) Bid-Ask Spread ?????????????????????????????????????????????????????? bid ????????? ask ???????????????????????? ?????????????????????????????? ???????????? XYZ ?????? Bid 100 ????????? Ask 101 ????????? Spread 1 ????????? ????????????????????????????????????????????????????????????????????? 101 (Ask) ??????????????????????????????????????????????????????????????? 100 (Bid) Spread ????????? = market ?????? liquidity ????????? (?????????????????????????????????) Spread ??????????????? = market ?????? liquidity ????????? (??????????????????) ??????????????????????????????????????????????????? Bid ????????????????????????????????????????????????????????????????????? Reserve Price ??????????????????????????????????????????????????????????????????????????????????????? (??????????????? Ask)
Q: Real-Time Bidding (RTB) ??????????????????????????????????????????????
A: RTB ?????????????????????????????? 100 milliseconds (0.1 ??????????????????) ??????????????? user ???????????????????????????????????? publisher ????????? bid request ?????? ad exchange ??????????????? 10ms ad exchange ???????????????????????? DSPs (Demand-Side Platforms) ????????? advertisers DSPs ????????????????????? user data, targeting, budget ????????????????????? bid ??????????????????????????? 50-80ms ad exchange ??????????????? bid ?????????????????? ???????????????????????????????????????????????? ??????????????????????????????????????????????????? 100ms ??????????????????????????????????????????????????????????????? ???????????? RTB ??????????????????????????????????????????????????????????????????????????????????????????????????? infrastructure ???????????????????????? low-latency ????????? ????????? in-memory database, edge computing, distributed systems
Q: Google Ads ?????????????????? bidding strategy ???????????????????
A: ????????????????????????????????????????????? ??????????????? traffic ????????? Maximize Clicks ???????????? daily budget ????????????????????? Google optimize, ??????????????? conversions ????????? Target CPA (?????????????????? 30+ conversions/???????????????) ???????????? target CPA ????????????????????????????????????, ??????????????? revenue ????????? Target ROAS (???????????? track revenue) ???????????? target ROAS ???????????? 400%, Brand awareness ????????? Target Impression Share ??????????????? top of page, ???????????????????????? ????????? Manual CPC ??????????????????????????????????????? data ????????????????????????????????????????????????????????? automated bidding ????????????????????? data ????????????????????? ???????????????????????? ???????????? track conversions ?????????????????????????????? automated bidding ?????????????????????????????????????????????
Q: ?????????????????????????????????????????????????????? (e-Bidding) ????????????????????????????
A: e-Bidding ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????? ??????????????? TOR (Terms of Reference) ?????????????????????????????????, ???????????????????????????????????? ?????????????????????????????? ??????????????????????????????????????? ???????????????, ???????????????????????????????????????????????????????????? (???????????????????????? e-GP), ???????????????????????????????????????????????????????????????????????????????????? ???????????? deadline, ???????????????????????????????????????????????????????????????????????????????????????????????????, ???????????????????????? ???????????????????????? ???????????? TOR ????????????????????? ?????????????????????????????????, ????????????????????????????????????????????? ?????????????????????????????????????????????????????????, ???????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????, ??????????????????????????????????????? ???????????????????????????????????????????????????