Deploy a resource
Pocket Gateway
4 minute read
We’re now going to deploy a resource–an artificial intelligence, on the Pocket Cloud
.
A resource is a set of one or more trained policies which carry out a set of pre-defined tasks. In other words, a resource is an “AI” that performs actions on behalf of the calling user.
Resources are identified by a family
and name
. Resources within the same family are logically related. Once a resource is deployed on the Pocket Cloud
It is assigned an id , a universally unique RFC 4122
complaint identifier.
Employ a resource
For this example, we’ll be using the simple-manager
resource which constructs a random financial portfolio. This resource is always used in sandbox mode so you don’t need to worry about incurring billing charges.
We’re going to employ a resource with a few configurable parameters.
Resource families
have different configurable parameters.
|
|
Variable | Description | |
---|---|---|
USER_RESOURCE_SECTOR |
One or more financial sectors to which the resource is being deployed to | |
USER_RESOURCE_EXCHANGE |
A specific financial exchange the resource will read data from and submit orders to | |
USER_RESOURCE_PRODUCT |
An array of products(tickers/symbols) to be used | |
USER_RESOURCE_ALLOCATION |
A percentage of the user’s account size to be allocated to the resource; i.e., “allocate 20% of my account size to this portfolio manager.” | |
USER_RESOURCE_CONFIG_FREQUENCY |
How frequently the resource can take actions; e.g., rebalance, adjust positions, place and cancel orders. | |
USER_RESOURCE_CONFIG_MAX_SIZE |
The largest possible order size that the resource may submit. |
-
Note: the resource’s balance may increase or decrease in percentage terms as it relates to the original account balance. As a result, you may experience significant “drift” from the original percentage allocation to the current time’s present allocation.
-
Note: the more frequent the data, the more potential actions, and the more potential trading costs.
-
Note: observe that a resource may place multiple orders over sequential time-steps resulting in a “total lot size” greater than
max_size
|
|
|
|
After employing the resource, you should receive a status message:
|
|
|
|
Verify resource status
To check on the status of the resource, query the /resource/ping
endpoint
|
|
|
|
|
|
|
|
Retire a resource
You’ll probably want to shutdown your resource after awhile. Let’s send a POST
request to the resource/retire
endpoint and teardown our running resource.
- You’ll need the
USER_RESOURCE_ID
environment variable from above.
|
|
|
|
You should then see something like the below. (it may take a moment for the resource to properly cleanup and shutdown)
|
|
|
|
👍 Zvinoshamisa! You’ve employed and retired your first AI onto the Pocket Cloud
!