---
# System prepended metadata

title: Bet Type Description

---

Bet Type & Market & Settlement Description
-------------------------

# Bet Type Description
```json=
[

{
    "id" : 39,
    "name" : "Game Handicap", 
    "way" : 2,
    "is_bool" : false,
    "has_live": false,
    "has_specifier": false,
    "has_line": true,
    "has_param": false,
    "has_participant": true,
    "has_param_string": false,
    "enable":true
    "selections" :["home", "away"] //16,17
  },
  {
    "id" : 47,
    "name" : "Over/Under", 
    "way" : 2,
    "is_bool" : true,
    "has_live": true,
    "has_line": true,
    "has_specifier": false,
    "has_param": false,
    "has_participant": false,
    "has_param_string": false,
    "enable":true
    "selections" :["over", "under"] // 2,3
  }, {
    "id": 48,
    "name" : "Asian Handicap", 
    "way" : 2,
    "is_bool" : false,
    "has_live": false,
    "has_specifier": false,
    "has_line": true,
    "has_param": false,
    "has_participant": true,
    "has_param_string": false,
    "enable":true
    "selections" :["home", "away"] //7,8
  }, {
    "id": 69,
    "name" : "Home Draw Away", 
    "way" : 3,
    "is_bool" : false,
    "has_live": true,
    "has_line": false,
    "has_specifier": false,
    "has_param": false,
    "has_participant": true,
    "has_param_string": false,
    "enable":true
    "selections" :["home", "away", "draw"] //4,5,6
  }, {
    "id": 71,
    "name" : "Set Handicap", 
    "way" : 2,
    "is_bool" : false,
    "has_live": true,
    "has_line": true,
    "has_specifier": false,
    "has_param": false,
    "has_participant": true,
    "has_param_string": false,
    "enable":true
    "selections" :["home", "away"] //18,19
  }, {
    "id": 355,
    "name" : "Asian Handicap With Score", 
    "way" : 2,
    "is_bool" : false,
    "has_live": true,
    "has_line": true,
    "has_specifier": true,
    "has_param": false,
    "has_participant": true,
    "has_param_string": false,
    "enable":true
    "selections" :["home", "away"] //9,10
  }, {
    "id": 466,
    "name" : "Match Winner", 
    "way" : 2,
    "is_bool" : false,
    "has_live": true,
    "has_line": false,
    "has_specifier": false,
    "has_param": false,
    "has_participant": true,
    "has_param_string": false,
    "enable":true
    "selections" :["home", "away"] //20,21
  }
]
```

# Market Description
## All Columns 
```json=
{
  "market_id" : int64,
  "match_id" : int64, 
  "bet_type_id" : int16,
  "is_live" : bool, 
  "period_id" : int,
  "status" : int8,
  "line" : double,
  "specifier" : string,
  "margin" : double,
  "number_of_outcomes" : int8, //2
  "version" : int,
  "outcomes" : [{
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : "home",
      "participant_id" : int64,
      "string": string,
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : "away",
      "participant_id" : int64,
       "string": string,
    }, 
  ]
}
```
### Asia Handicap : 48
```json
{
  "market_id" : int64,
  "match_id" : int64, 
  "bet_type_id" : int16,
  "is_live" : bool, 
  "period_id" : int,
  "status" : int8,
  "line" : double,
  "margin" : double,
  "number_of_outcomes" : int8, //2
  "version" : int,
  "outcomes" : [{
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 7, //home
      "participant_id" : int64
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 8,//away
      "participant_id" : int64
    }, 
  ]
}
```

### Over Under : 47
```json
{
  "market_id" : int64,
  "match_id" : int64, 
  "bet_type_id" : int16,
  "is_live" : bool, 
  "period_id" : int,
  "status" : int8,
  "line" : double,
  "margin" : double,
  "number_of_outcomes" : int8, //2
  "version" : int,
  "outcomes" : [{
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 2, //over
      "result_type" : int8
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" :3, //under
      "result_type" : int8
    } 
  ]
}
```
### Home Draw Away : 69
```json
{
  "market_id" : int64,
  "match_id" : int64, 
  "bet_type_id" : int16,
  "is_live" : bool, 
  "period_id" : int,
  "status" : int8,
  "line" : double,
  "margin" : double,
  "number_of_outcomes" : int8, //3
  "version" : int,
  "outcomes" : [{
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 4, //home
      "result_type" : int8
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection": 5, //away
      "result_type" : int8
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection": 6, //draw
      "result_type" : int8
    },   ]
}
```

### Asian Handicap With Score : 355
param_float3 is handicap value, 
if param_participant_id_3 == param_participant_id_1 then hdp mean for home team.
else mean for away team, need to reverser the sign of hdp
```json
{
  "market_id" : int64,
  "match_id" : int64, 
  "bet_type_id" : int16,
  "is_live" : bool,  // true
  "period_id" : int,
  "status" : int8,
  "line" : double,
  "margin" : double,
  "number_of_outcomes" : int8, //2
  "specifier" : string, // the score of match now; "0:0", "0:1"
  "version" : int,
  "outcomes" : [{
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 9,//home
      "result_type" : int8
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection": 10, //away
      "result_type" : int8
    }  
  ]
}
```
### Match Winner : 466
```json
{
  "market_id" : int64,
  "match_id" : int64, 
  "bet_type_id" : int16,
  "is_live" : bool, 
  "period_id" : int,
  "status" : int8,
  "margin" : double,
  "number_of_outcomes" : int8, //2
  "version" : int,
  "outcomes" : [{
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 20, //home
      "participant_id" : int64
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 21,//away
      "participant_id" : int64
    }, 
  ]
}
```
### Game Handicap : 39
```json
{
  "market_id" : int64,
  "match_id" : int64, 
  "bet_type_id" : int16,
  "is_live" : bool, 
  "period_id" : int,
  "status" : int8,
  "line" : double,
  "margin" : double,
  "number_of_outcomes" : int8, //2
  "version" : int,
  "outcomes" : [{
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 16, //home
      "participant_id" : int64
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 17,//away
      "participant_id" : int64
    }, 
  ]
}
```
### Set Handicap : 71
```json
{
  "market_id" : int64,
  "match_id" : int64, 
  "bet_type_id" : int16,
  "is_live" : bool, 
  "period_id" : int,
  "status" : int8,
  "line" : double,
  "margin" : double,
  "number_of_outcomes" : int8, //2
  "version" : int,
  "outcomes" : [{
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 18, //home
      "participant_id" : int64
    }, {
      "id" : int64,
      "odds": float64,
      "status" : int8, 
      "selection" : 19,//away
      "participant_id" : int64
    }, 
  ]
}
```

### Settlement
```json
[]
```

### EM Bet Type <-> Outcome Type
39 : {17:team1/team2}

47 : {13: over, 14: under}
48 : {60: team}
69 : {10: team1/team2, 11 : draw}
71 : {50: tem11/team2}
355 : {367 : team}
466 : {104: team1/team2}

### Mapping Flow
EM data push sequence : outcome -> betting offer -> market -> market outcome relation 

source_outome combine odds, betting_offer_status, is_live from betting_offer ; then create cs_outcome  id update into source_outcome cs_id.

market -> create cs_match, then by the bet type template check outcome amount. if complete outcome mapping and market staus was not closed then push out with above format.

If bet type is 2way, update outcome id, odds, status to market table.
If all outcome belong to this market was open, then update market status to open.
And 2/3way if any outcome status was closed, then update market status to closed.
And 2/3way if any outcome status was suspended, and origin market status was open then update market status to suspended.
Otherwise don't update market status.

If bet type is variable or 3way, 
outcome status only update outcome status.
Market staus update by source_market is_closed. if source_market is_closed is false, then update market status to open, else to closed.

When market is being create, search the em-bettype_outcometype_relation table, get the outcome type about this betting type.
and select all the outcome, and group by cs_bet_type_template condition, and then insert/update to related table.
![](https://i.imgur.com/siIp2jr.png)

### Live Odds 
```jsonld=
{
    "bettingoffer": [
        {
            "id": 1234,
            "type": "create/update/delete",
            "lastchangetime":123,
            "odds":123,
            "version":13,
        }
    ],
    "outcome":[
        {
            "id": 1234,
            "type": "create/update/delete",
        },
    ],
    "MarketOutcomeRelation":[
     {
             "id": 1234,
            "type": "create/update/delete",
        },
    ],
    ,
    "market":[
        {
            "id": 1234,
            "type": "create/update/delete",
            "iscomplete":false,
            "version":13,
        }
    ]
}
```
#### Delete 
betting offer: 2way close outcome and market, 3way close outcome
outcome : 2way close outcome and market, 3way close outcome
market : close market

#### Create
(好像會一起來?)
betting offer: 2way close outcome and market, 3way close outcome
outcome : 2way close outcome and market, 3way close outcome
market : close market
league
event
event template
participant
eventinfo   eventaction  eventactiondetail
eventparticipantrelation   eventparticipantinfo
participant  participantrelation  participantusage
streamingprovider  streamingprovidereventrelation  
#### Update
betting offer : update odds and is live.
outcome: update status 

#### MYSQL In memory
/dev/shm
datadir=/dev/shm/data
[How to Change or Move MySQL /tmp Directory to tmpfs](https://evoluso.com/how-to-change-or-move-mysql-tmp-directory-to-tmpfs/)


# Event action status/eventinfostatus/eventactiondetailstatus
```jsonld=
{
	"amount": 4,
	"data": [{
		"eventactionstatus": {
			"isavailable": true,
			"name": "Resolved",
			"description": "The event action is final state. It could be relied on, no updates are expected unless for late corrections.",
			"id": 4,
			"version": 0
		}
	}, {
		"eventactionstatus": {
			"isavailable": false,
			"name": "Invalid",
			"description": "The event action is invalid.",
			"id": 3,
			"version": 0
		}
	}, {
		"eventactionstatus": {
			"isavailable": false,
			"name": "Removed",
			"description": "The event action is removed from the provider data source.",
			"id": 2,
			"version": 0
		}
	}, {
		"eventactionstatus": {
			"isavailable": true,
			"name": "Standard",
			"description": "The event action is active and it could be relied on.",
			"id": 1,
			"version": 0
		}
	}],
	"provider": 1,
	"type": "eventactionstatus"
}
```