Manipulate events composed of group object, activate and deactive by shifting time window and event priority.

| Field | Type | Null | Key | Default | Extra |
|---|---|---|---|---|---|
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| cashflow_group_id | varchar(10) | YES | NULL | ||
| offer_id | varchar(10) | NO | NULL | ||
| affiliates | varchar(100) | YES | NULL | ||
| name | varchar(100) | YES | NULL | ||
| description | text | YES | NULL | ||
| percent | decimal(4,2) | YES | 0.00 | ||
| rate | decimal(10,2) | YES | 0.00 | ||
| default_value | text | NO | NULL | ||
| actived_from | datetime | NO | NULL | ||
| actived_to | datetime | NO | NULL | ||
| created_at | datetime | NO | NULL | ||
| rules | text | YES | NULL | ||
| status | varchar(20) | NO | NULL | ||
| group_type | varchar(5) | NO | NULL | ||
| follow | tinyint(3) unsigned | NO | NULL | ||
| sub_1 | text | YES | NULL |
$ cd path/to/project
$ pip install -r requirements.txt -t .| Parameter | Type | Required | Description |
|---|---|---|---|
| offer_id | int | Required | id of the offer to initialize the object |
| branch_at | datetime string | Optional | fetch specific configuration from given datetime (YYYY-mm-dd HH:MM:SS), if None is given, configuration in the current will be used |
from GroupSchedule import OfferGroupCursor
# get offer 1544 current setting.
cursor = OfferGroupCursor(1544)
# get offer 1544 setting at 2019-01-01 18:00:00
cursor = OfferGroupCursor(1544, branch_at='2019-01-01 18:00:00')None| Attributes | Type | Description |
|---|---|---|
| offer_id | int | id of the initialized offer |
| actived_from | string | datetime of this configuration start |
| actived_to | string | datetime of this configuration end |
| default_value | JSON string | default percentage and rate value of this configuration |
| groups | list | list with groups object |
| branch_at | datetime string | datetime specified for fetching specific configuration |
| created_at | datetime string | datetime when this configuration was created |
| ptype | string | payout type of this object as following 'cpa_percentage', 'cpa_rate', 'cpa_both' |
search groups inside the cursor by filtering name or value.
| Parameter | Type | Required | Description |
|---|---|---|---|
| text_filter | string | Optional | key for group name search |
| value_filter | string | Optional | key for group value search |
| return_object | string | Optional | return list with eligible groups |
groups = cursor.group_display(text_filter='AU')# dictionary in list
[{'name': 'AU',
'description': 'AU Group',
'affiliates': [],
'rules': [{'id': '1234',
'cashflow_group_id': '2345',
'field': 'field7',
'operator': 'IN',
'value': ['rule_value_1'],
'negate': '0'},
{'id': '4567',
'cashflow_group_id': '2345',
'field': 'field8',
'operator': 'IN',
'value': ['rule_value_2'],
'negate': '1'}],
'cashflow_group_id': '2345',
'offer_id': 1544,
'percent': '10',
'rate': None,
'follow': 1}]
# group object in list if return_object=True
[GroupSchedule.Group]append new group into cursor with either one of percent or rate assigned at least.
| Parameter | Type | Required | Description |
|---|---|---|---|
| cashflow_group_id | int | Required | id of cashflowgroup object |
| percent | float | Optional | percent(%) type value |
| rate | float | Optional | rate($) type value |
cursor.group_append(2000, percent=5.5, rate=30)Noneremove group from cursor object.
| Parameter | Type | Required | Description |
|---|---|---|---|
| cashflow_group_id | int | Required | id of cashflowgroup object |
cursor.group_remove(2000)Noneassign default percent or rate for object
| Parameter | Type | Required | Description |
|---|---|---|---|
| percent | float | Optional | percent(%) value, default as 0 |
| rate | float | Optional | rate($) value, default as 0 |
cursor.setup_default_value(percent=10, rate=5.5)#JSON format string
'{
"max_payout": 5.5,
"default_payout": 5.5,
"max_percent_payout": 10,
"percent_payout": 10
}'specify start and end datetime for the ready-to-push configuration.
| Parameter | Type | Required | Description |
|---|---|---|---|
| actived_from | datetime string | Required | start date of this configuration |
| actived_to | datetime string | Required | end date of this configuration |
| is_base | Boolean | Optional | _setup eternal configuration of this cursor, groups of this _ |
# set specific time range for this configure
cursor.setup_period(actived_from='2019-01-01 00:00:00', actived_to='2019-01-31 23:59:59')
# set baseline for this object to have every configure fallback to
cursor.setup_period(is_base=True)Nonepush the configuration into database
| Parameter | Type | Required | Description |
|---|---|---|---|
| utc | int | Optional | push the configuration into database and wait for activation |
cursor.push_cursor()Nonedeploy configuration loaded on cursor object to server.
cursor.deploy_cursor()None# group object will be initialized along with cursor object.
group = cursor.groups[0]| Attributes | Type | Description |
|---|---|---|
| cashflow_group_id | int | id of group |
| offer_id | int | id of the initialized offer with group included |
| percent | decimal(4,2) | percent value of this group |
| rate | decimal(10,2) | decimal value of this group |
| db_id | int | auto increment number in database if cursor is fetched from database |
| follow | tiny int | a binary number to determine whether this group is created by branch as a copy (1) or has been assigned value that need to be prioritized (0) |
assign percent of rate value to the group object, group with value assigned by this function will be prioritized and always be fetched when this cashflow_group_id is also existed in the cursor configuration.
| Parameter | Type | Required | Description |
|---|---|---|---|
| percent | float | Optional | percent(%) value, default as 0 |
| rate | float | Optional | rate($) value, default as 0 |
None