RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Classes | Public Types | Public Member Functions | Public Attributes
RTBKIT::BiddingAgent Struct Reference

#include <bidding_agent.h>

Inheritance diagram for RTBKIT::BiddingAgent:
Datacratic::ServiceBase Datacratic::MessageLoop Datacratic::EventRecorder Datacratic::Epoller Datacratic::AsyncEventSource RTBKIT::FixedPriceBiddingAgent RTBKIT::TestAgent TestAgent

List of all members.

Classes

struct  RequestStatus
struct  RouterMessage

Public Types

typedef void( BidRequestCb )(double timestamp, Id id, std::shared_ptr< BidRequest > bidRequest, const Bids &bids, double timeLeftMs, Json::Value augmentations)
typedef boost::function
< BidRequestCb > 
BidRequestCbFn
typedef void( ResultCb )(const BidResult &args)
typedef boost::function< ResultCb > ResultCbFn
typedef void( DeliveryCb )(const DeliveryEvent &args)
typedef boost::function
< DeliveryCb > 
DeliveryCbFn
typedef void( PingCb )(const std::string &fromRouter, Date timestamp, const std::vector< std::string > &args)
typedef boost::function< PingCb > PingCbFn
typedef void( ErrorCb )(double timestamp, std::string description, std::vector< std::string > originalError)
typedef boost::function< ErrorCb > ErrorCbFn

Public Member Functions

 BiddingAgent (std::shared_ptr< ServiceProxies > proxies, const std::string &name="bidding_agent")
 BiddingAgent (ServiceBase &parent, const std::string &name="bidding_agent")
 BiddingAgent (const BiddingAgent &other)
BiddingAgentoperator= (const BiddingAgent &other)
void strictMode (bool strict)
void init ()
void start ()
void shutdown ()
void doBid (Id id, const Bids &bids, const Json::Value &meta=Json::Value())
void doConfig (const AgentConfig &config)
void doConfigJson (Json::Value config)
void doPong (const std::string &fromRouter, Date sent, Date received, const std::vector< std::string > &payload)

Public Attributes

std::string agentName
BidRequestCbFn onBidRequest
ResultCbFn onWin
ResultCbFn onLoss
ResultCbFn onNoBudget
ResultCbFn onTooLate
ResultCbFn onDroppedBid
ResultCbFn onInvalidBid
DeliveryCbFn onImpression
DeliveryCbFn onClick
DeliveryCbFn onVisit
PingCbFn onPing
ErrorCbFn onError

Detailed Description

Proxy class that a bidding agent uses to communicate with the rest of the system (routers, post auction loops, agent configuration service).

In order for a router to start sending bid request to an agent, the agent must first set up its configuration using the doConfig function. The bidding agent

Definition at line 50 of file bidding_agent.h.


Member Function Documentation

void RTBKIT::BiddingAgent::doBid ( Id  id,
const Bids bids,
const Json::Value meta = Json::Value() 
)

Send a bid response to the router in answer to a received auction.

Parameters:
idauction id given in the auction callback.
responsea Bids struct converted to json.
metaA json blob that will be returned as is in the bid result.

Gather some stats

Definition at line 466 of file bidding_agent.cc.

void RTBKIT::BiddingAgent::doConfig ( const AgentConfig config)

Notify the AgentConfigurationService that the configuration of the bidding agent has changed.

Note that bidding agent will remember the given configuration which will be usedto answer any further configuration requests that are received. This function is thread-safe and can be called at any time to change the bid request which will be received by the agent. Note that update are done asynchronously and changes might not take effect immediately.

Definition at line 542 of file bidding_agent.cc.

void RTBKIT::BiddingAgent::doPong ( const std::string &  fromRouter,
Date  sent,
Date  received,
const std::vector< std::string > &  payload 
)

Sent in response of a onPing callback and is used to notify the router that our agent is still alive and responsive. The fromRouter, sent and payload arguments should be passed as is from the callback arguments. The received argument should be the time at which the message was received.

Todo:
received should be sampled by the doPong function.

Definition at line 525 of file bidding_agent.cc.

void RTBKIT::BiddingAgent::strictMode ( bool  strict) [inline]

If set to true then an exception will thrown if a callback is not registered. Defaults to true.

Definition at line 70 of file bidding_agent.h.


Member Data Documentation

Name of the agent which defaults to the <service name>="">_<pid>. This should be set before calling init().

Definition at line 65 of file bidding_agent.h.

Called whenever bid request is received that matches the agent's filters specified in its configuration.

To place a bid the target of this callback should call the doBid function with the id and the bids object. The router is in charge of enforcing the time constraint and will raise either the onTooLate or the onDroppedBid callback to notify the agent of late or missing bids.

Note that it's recomended to always call the doBid function even if no bids are to be placed. Doing so will allow the router to resolve auctions more quickly and will therefor improve overall performances.

Once the bids have been placed, one of the ResultCbFn callbacks will be triggered asynchronously to notify the agent of the result of the bid. In the case of a win, one of the DeliveryCbFn callbacks will be triggered asynchronously to notify the agent of delivery events. Note that it's possible for delivery callbacks to be triggered for an auction before its respective ResultCbFn callback.

Note that bid results and delivery events will be triggered once per impression that was bid on. As an example, if we bid on 3 impressions in an auction with 5 available impressions then we will receive 3 bid result notification.

Definition at line 154 of file bidding_agent.h.

Triggered when a user clicks on one of our creatives.

Definition at line 190 of file bidding_agent.h.

Triggered when the router did not receive a bid for given bid request.

Definition at line 176 of file bidding_agent.h.

Triggered whenever router receives an invalid message from the agent. This can either be caused by an invalid config, and invalid bid

Definition at line 220 of file bidding_agent.h.

Triggered when an impression we bid on is shown to the user.

Definition at line 187 of file bidding_agent.h.

An error was found in the placed bid. This will usually be triggered if an invalid creative or impression was selected for the bid.

Definition at line 180 of file bidding_agent.h.

We lost either the internal router auction or the exchange auction.

Definition at line 165 of file bidding_agent.h.

No bids were placed because the the account for our agent does not contain enough funds.

Definition at line 169 of file bidding_agent.h.

Triggered periodically by the router to determine whether the agent is still alive and responsive.

If overriden, then the target should call the doPong function with the fromRouter, timestamp and args field untouched. If not overriding, the agent is assumed to be responsive as long as this message loop is responsive.

Definition at line 209 of file bidding_agent.h.

No bids were placed because the agent placed its bid after the auction was sent back to the exchange.

Definition at line 173 of file bidding_agent.h.

Triggered when a user visits the landing page of our creative.

Definition at line 193 of file bidding_agent.h.

We won the auction and we should expect to receive delivery noticifation shortly if not already received.

Definition at line 162 of file bidding_agent.h.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator