Proof of Idea

Closes a Signal based Investment Idea within an Investment Strategy. This is the equivalent of closing a real position.

Strategy Reference

The long form reference returned when the idea was first created should be used.

Ticker

This must be the same, pimary ticker that was used to create the Investment Idea i.e. not an alternative ticker.

Alternative Tickers

It is not possible to change the alternative tickers from those that were passed in upon creation, therefore they can be be passed in at the point of closure.

Pricing

The same pricing provider should be used.

The credentials for the provider must be passed again as they are not persisted.

Close Idea Object

Create the object to be posted.


// Initialize the SDK
const activ = await getActiv();

// Build the Idea object
const payload: CI.ICloseIdeaRequest = {
	strategyReference: '',
	ticker: '',
	pricingCredentials: {
		provider: '',
		credentials: {
			key: '',
			secret: '',
		},
	},
}

Close Idea Request

A retry mechanism can be useful to ensure that the process completes successfully.


const data = await Helper.retryFunctionHelper<any>({
	maxRetries: 3,
	retryCallback: async () => {
		return activ.closeIdea(payload);
	},
	notificationCallback: async (error: string, retryIndex: number) => {

		log({
			message: `[closeActivTradeIdeaByTicker] Error closing Activ Idea (retry ${retryIndex}): ${error}`,
			type: 'error',
		});

	}
});

Last updated