---
# System prepended metadata

title: EveryMatrix Dynamic Update
tags: [SBK]

---

EveryMatrix Dynamic Update
==========================
###### tags: `SBK`
```json
{
	"create": {
		"MarketOutcomeRelation": [{
			"outcomeid": 109493642445676544,
			"id": 109493642515849472,
			"type": "create",
			"version": 0,
			"marketid": 109493642515849216
		}],
		"Market": [{
			"eventid": 109251467961061376,
			"iscomplete": false,
			"numberofoutcomes": 2,
			"paramfloat1": 1,
			"isclosed": false,
			"paramfloat2": 10,
			"paramfloat3": 0.5,
			"type": "create",
			"version": 0,
			"name": "Over/Under 0.5 In 1-10, Ordinary Time",
			"id": 109493642515849216,
			"eventpartid": 3,
			"bettingtypeid": 82
		}]
	},
	"update": {
		"BettingOffer": [{
			"statusid": 1,
			"lastchangedtime": "2020-07-05 13:54:34.626",
			"id": 109492788793578250,
			"type": "update",
			"version": 17
		}, {
			"statusid": 1,
			"lastchangedtime": "2020-07-05 13:54:34.626",
			"id": 109492788793578506,
			"type": "update",
			"version": 16
		}, {
			"statusid": 1,
			"lastchangedtime": "2020-07-05 13:54:34.626",
			"id": 109492788793578762,
			"type": "update",
			"version": 17
		}]
	},
	"delete": {}
} 
```

# Create
## Market Outcome Relation
[]MarketOutcomeRelation + []Market
```json
 {
        "MarketOutcomeRelation": [{
                "outcomeid": 109044226476540160,
                "id": 109044226522751232,
                "type": "create",
                "version": 0,
                "marketid": 109044226522750976
        }],
        "Market": [{
                "eventid": 109014067150213120,
                "iscomplete": false,
                "name": "Points Asian Handicap (-7.5), Whole Match",
                "paramparticipantid1": 96427126997123072,
                "numberofoutcomes": 2,
                "paramfloat1": 7.5,
                "id": 109044226522750976,
                "eventpartid": 240,
                "isclosed": false,
                "type": "create",
                "version": 0,
                "bettingtypeid": 62
        }]
}
```
```json
{
        "MarketOutcomeRelation": [{
                "outcomeid": 109044226476540672,
                "id": 109044226522751744,
                "type": "create",
                "version": 0,
                "marketid": 109044226522750976
        }],
        "Market": [{
                "iscomplete": true,
                "id": 109044226522750976,
                "type": "update",
                "version": 1
        }]
} 
```
收到market create, 存進source_makret
market outcome relation先save去source market outcome relation.
## Outcome
[]Outcome
```jsonld=
{
	"Outcome": [{
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 1350035,
		"typeid": 209,
		"paramfloat1": 2,
		"id": 109109606184243200,
		"isnegation": false,
		"eventpartid": 423,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 853707,
		"typeid": 209,
		"paramfloat1": 2,
		"id": 109109606184243456,
		"isnegation": false,
		"eventpartid": 423,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 853707,
		"typeid": 209,
		"paramfloat1": 3,
		"id": 109109606184243712,
		"isnegation": false,
		"eventpartid": 423,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 1350035,
		"typeid": 209,
		"paramfloat1": 3,
		"id": 109109606184243968,
		"isnegation": false,
		"eventpartid": 423,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 1350035,
		"typeid": 209,
		"paramfloat1": 4,
		"id": 109109606184244224,
		"isnegation": false,
		"eventpartid": 423,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 853707,
		"typeid": 209,
		"paramfloat1": 4,
		"id": 109109606184244480,
		"isnegation": false,
		"eventpartid": 423,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 1350035,
		"typeid": 209,
		"paramfloat1": 6,
		"id": 109109606184244736,
		"isnegation": false,
		"eventpartid": 422,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 853707,
		"typeid": 209,
		"paramfloat1": 6,
		"id": 109109606184244992,
		"isnegation": false,
		"eventpartid": 422,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 853707,
		"typeid": 209,
		"paramfloat1": 5,
		"id": 109109606184245248,
		"isnegation": false,
		"eventpartid": 422,
		"type": "create",
		"version": 0
	}, {
		"eventid": 109104525851381760,
		"statusid": 1,
		"paramparticipantid1": 1350035,
		"typeid": 209,
		"paramfloat1": 5,
		"id": 109109606184245504,
		"isnegation": false,
		"eventpartid": 422,
		"type": "create",
		"version": 0
	}]
}
```
寫入source outcome

## Betting Offer
[]BettingOffer
```jsonld=
{
	"BettingOffer": [{
		"sourceid": 99699819167322112,
		"multiplicity": 0,
		"islive": true,
		"slotnum": 1,
		"outcomeid": 109105600921665536,
		"type": "create",
		"version": 0,
		"statusid": 1,
		"lastchangedtime": "2020-07-01 07:07:10.099",
		"providerid": 3001183,
		"odds": 1.7692307,
		"couponkey": "?matchid=109105179791609856&seOutcomeid=109105600921665536",
		"id": 109105622552810506,
		"bettingtypeid": 198
	}, {
		"sourceid": 99699819167322112,
		"multiplicity": 0,
		"islive": true,
		"slotnum": 1,
		"outcomeid": 109105600921665792,
		"type": "create",
		"version": 0,
		"statusid": 1,
		"lastchangedtime": "2020-07-01 07:07:10.099",
		"providerid": 3001183,
		"odds": 1.8695652,
		"couponkey": "?matchid=109105179791609856&seOutcomeid=109105600921665792",
		"id": 109105622552810762,
		"bettingtypeid": 198
	}, {
		"lastchangedtime": "2020-07-01 07:07:10.004",
		"odds": 1.6666666,
		"id": 109105599369842698,
		"type": "update",
		"version": 2
	}, {
		"statusid": 4,
		"lastchangedtime": "2020-07-01 07:07:10.005",
		"id": 109083487145957130,
		"type": "update",
		"version": 10
	}, {
		"statusid": 4,
		"lastchangedtime": "2020-07-01 07:07:10.005",
		"id": 109083487145956874,
		"type": "update",
		"version": 9
	}]
}
```
該批的create betting offer records 全寫入source outcome後, 根據event id 開始做market aggregate.

## Event Action
[]EVent Action
```jsonld=
{
	"amount": 10000,
	"data": [{
				"eventaction": {
					"eventid": 109014416903786496,
					"statusid": 4,
					"providerid": 3000979,
					"typeid": 21,
					"paramfloat1": 1,
					"id": 109125967489810432,
					"eventpartid": 241,
					"version": 1
				}
			}, {
				"eventaction": {
					"eventid": 108958542433767424,
					"statusid": 4,
					"providerid": 3000979,
					"typeid": 21,
					"paramfloat1": 3,
					"id": 109040944333996288,
					"eventpartid": 245,
					"version": 1
				}
			}, {
				"eventaction": {
					"eventid": 109060014652674048,
					"statusid": 4,
					"providerid": 3000979,
					"typeid": 21,
					"paramfloat1": 2,
					"id": 109071593220620544,
					"eventpartid": 242,
					"version": 1
				}
			}
```
## Event Action Detail
[]Event Action Detail
```json=
{
	"amount": 10000,
	"data": [{
				"eventactiondetail": {
					"eventactionid": 109041390808219904,
					"statusid": 4,
					"paramparticipantid1": 99638260926664704,
					"typeid": 1,
					"id": 109041391010595072,
					"version": 1
				}
			}, {
				"eventactiondetail": {
					"eventactionid": 109042563411886336,
					"statusid": 1,
					"paramparticipantid1": 1226060,
					"typeid": 1,
					"id": 109042563536666880,
					"version": 0
				}
			}, {
				"eventactiondetail": {
					"eventactionid": 109037646790017280,
					"statusid": 4,
					"paramparticipantid1": 6805780112097280,
					"typeid": 1,
					"id": 109037705928655104,
					"version": 0
				}
			}
```
## EventTemplate
[]EventTemplate
```json=
{
	"EventTemplate": [{
		"rootpartid": 1,
		"sportid": 107,
		"eventtypeid": 2,
		"venueid": 240,
		"name": "OWL Summer Showdown",
		"id": 109105784058544128,
		"type": "create",
		"version": 0
	}]
}
```
存進source event template,
開始新增league template主檔

## Event
[]Event(create) + []Event(update isComplete) + []EventParticipantRelation
```json=
{
	"Event": [{
		"iscomplete": false,
		"deletetimeoffset": 43200000,
		"endtime": "2020-07-02 18:51:00.0",
		"starttime": "2020-07-02 18:45:00.0",
		"templateid": 108480213798768640,
		"type": "create",
		"version": 0,
		"rootpartid": 1,
		"sportid": 27,
		"statusid": 1,
		"venueid": 229,
		"name": "6:45 Wheeling Island",
		"haslivestatus": false,
		"typeid": 2,
		"id": 109109600014454784
	}, {
		"iscomplete": true,
		"id": 109109600014454784,
		"type": "update",
		"version": 1
	}],
	"EventParticipantRelation": [{
		"participantid": 7184637743480832,
		"eventid": 109109600014454784,
		"participantroleid": 3,
		"id": 109109600014455808,
		"eventpartid": 1,
		"type": "create",
		"version": 0
	}, {
		"participantid": 7966409653383168,
		"eventid": 109109600014454784,
		"participantroleid": 3,
		"id": 109109600014456064,
		"eventpartid": 1,
		"type": "create",
		"version": 0
	}, {
		"participantid": 10434535757320192,
		"eventid": 109109600014454784,
		"participantroleid": 3,
		"id": 109109600014456320,
		"eventpartid": 1,
		"type": "create",
		"version": 0
	}, {
		"participantid": 7071635144196096,
		"eventid": 109109600014454784,
		"participantroleid": 3,
		"id": 109109600014456576,
		"eventpartid": 1,
		"type": "create",
		"version": 0
	}, {
		"participantid": 10049555331682304,
		"eventid": 109109600014454784,
		"participantroleid": 3,
		"id": 109109600014456832,
		"eventpartid": 1,
		"type": "create",
		"version": 0
	}, {
		"participantid": 9200266234564608,
		"eventid": 109109600014454784,
		"participantroleid": 3,
		"id": 109109600014457088,
		"eventpartid": 1,
		"type": "create",
		"version": 0
	}, {
		"participantid": 7253128860692480,
		"eventid": 109109600014454784,
		"participantroleid": 3,
		"id": 109109600014457344,
		"eventpartid": 1,
		"type": "create",
		"version": 0
	}, {
		"participantid": 6845375478513664,
		"eventid": 109109600014454784,
		"participantroleid": 3,
		"id": 109109600014457600,
		"eventpartid": 1,
		"type": "create",
		"version": 0
	}]
}
```
存進source match, 生成match主檔;
EventParticipantRelation存入source EventParticipantRelation後,
開始根據role id 寫入match team1/team2, 並檢查完成後, emit to MQ

## EventInfo
[]EventInfo
```json=
{
	"amount": 10000,
	"data": [{
				"eventinfo": {
					"eventid": 109045296306212864,
					"statusid": 4,
					"providerid": 3000979,
					"paramparticipantid1": 97807947997904896,
					"paramparticipantid2": 99957971449171968,
					"typeid": 1,
					"paramfloat1": 11,
					"id": 109153421996605696,
					"eventpartid": 243,
					"paramfloat2": 2,
					"version": 19
				}
			}, {
				"eventinfo": {
					"eventid": 109126257456861184,
					"statusid": 4,
					"providerid": 3000979,
					"paramparticipantid1": 99776313524637696,
					"paramparticipantid2": 109012396968923136,
					"typeid": 1,
					"paramfloat1": 0,
					"id": 109131599267774720,
					"eventpartid": 2251,
					"paramfloat2": 4,
					"version": 8
				}
			}
```

# Update
